User tests: Successful: Unsuccessful:
Code by Fiorino De Santo
make sure that the email cloaking still works as bevor.
Title |
|
Read the tracker item and you'll see why this is being proposed. It's not necessarily an issue with raw JS versus jQuery.
Yes. It's not an issue of raw JS vs jQuery. I think the real issue was the absence of the a div with an identifier. To fix that you do not require to use jQuery.
You should be able to replace:
jQuery('#cloak$rand').html('');
with:
document.getElementById('cloak$rand').innerHTML = '';
And the same for the other calls.
And the same for the other calls
the first is fixed but i don't know the/a replacement for:
jQuery('#cloak$rand').append(...)
Thanks @phproberto
It is done with zero-24@8b3d235
Worked perfect for me. Hope for a merge.
Travis fails. Can you fix that?
Can you tell us what failed as I couldn't figure out what caused the failed build.
The message according to Travis is this:
There was 1 failure:
1) JHtmlEmailTest::testCloak
Cloak e-mail with mailto link
Failed asserting that '<div id="cloak23364">JLIB_HTML_CLOAKING</div><script type='text/javascript'>
<!--
document.getElementById('cloak23364').innerHTML = '';
var prefix = 'ma' + 'il' + 'to';
var path = 'hr' + 'ef' + '=';
var addy23364 = 'admin' + '@';
addy23364 = addy23364 + 'joomla' + '.' + 'org';
document.getElementById('cloak23364').innerHTML += '<a ' + path + '\'' + prefix + ':' + addy23364 + '\'>';
document.getElementById('cloak23364').innerHTML += 'addy23364';
document.getElementById('cloak23364').innerHTML += '<\/a>';
//-->\n </script>' contains "document.write('<a ' + path + '\'' + prefix + ':' + addy".
/home/travis/build/joomla/joomla-cms/tests/unit/suites/libraries/cms/html/JHtmlEmailTest.php:32
I guess one needs to adjust the test because the JavaScript output changed.
Why have I suddenly become the unit test expert hides. Ummm I'll try and have a look but I'm so busy at the moment not sure when that will be. I don't think it will be that hard to do so it just depends when I get a free hour.
OK change this https://github.com/joomla/joomla-cms/blob/staging/tests/unit/suites/libraries/cms/html/JHtmlEmailTest.php#L30
from$this->StringContains("document.write('<a ' + path + '\'' + prefix + ':' + addy"),
to$this->StringContains(".innerHTML += '<a ' + path + '\'' + prefix + ':' + addy23364 + '\'>'"),
Why have I suddenly become the unit test expert
In german we have a saying "Among the blind the one-eyed is king"
Tested. Works as expected!
Works for me too
Travis still fails
Maybe try with $this->StringContains(".innerHTML += '<a ' + path + '\'' + prefix + ':' + addy"),
Since the number is random, we need to stop using this in the assertion and we can't use anything behind it.
merged @Bakual zero-24@51e0189
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2014-07-10 19:13:41 |
Travis fine now. Thanks all!
Great work. Will it be in the next Joomla release? Need to tell it my users as some are suffering from this bug. Will it be backported to Joomla 2.5?
It will be in the next release, yes.
We could backport it to 2.5 if someone wants to do a PR against the 2.5.x
branch.
I was just code reviewing this for a 2.5 backport and we've lost the open script tag in this PR. Yet we still have a close script tag. Seems dodgy.......
There is a opening script tag?
$replacement = '<div id="cloak' . $rand . '">' . JText::_('JLIB_HTML_CLOAKING') . '</div>' . "<script type='text/javascript'>";
facepalm
:D
Doesn't look like related to this change. I've tried on an older test site and it also behaves like this there.
I have reverted this and it works normally
I also have issues when using for example:
<p>ete@mysite.com</p>
reverting this PR solves all
but yes, after reverting the mail with été is also broken
I noticed that the opening comment for all of the Javascript tags are not commented out (especially on the Travis build error listed earlier). Shouldn't they be commented?
I have a solution. Preparing patch
I disagree with this. I think we should always look to raw javascript instead of jQuery if we can