|
Posted by Jerry Stuckle on 07/11/06 21:36
Mel wrote:
> On 2006-07-11 21:52:53 +1000, Jerry Stuckle <jstucklex@attglobal.net> said:
>
>>
>> Well, I haven't looked at the code, but I suspect htmlspecialchars(),
>> since it converts fewer characters and has fewer options, it would be
>> faster.
>>
>> The HTML validator on w3.org is decent, but it doesn't handle
>> javascript very well. I just ignore the errors in javascript; for
>> instance, something like:
>>
>> j=4&i;
>>
>> The "&i" is not a valid html entity - but it's valid javascript code.
>> And this javascript wouldn't work:
>>
>> j = 4%amp;i;
>
>
> No, it wouldn't, but valid XHTML _requires_ you to preclude the embedded
> JavaScript with the appropriate CDATA marker. The character '&' is
> reserved by the markup just like '>' and '<'. Not adhering to the
> outlined standards simply encourages bad markup and makes cross-browser
> compatibility more difficult. It's a big stretch to equate cross-browser
> issues with unencoded ampersands, but it's not that difficult to deal
> with. Javascript has some functional string methods for encoding HTML
> entities.
>
Who said anything about XHTML? This is straight html.
And the point is - this is valid javascript, but the validator on w3.org
doesn't recognize it as such. Therefore it spits out errors where there
are none.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
[Back to original message]
|