|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
The manual says that the default parameter is:
ENT_COMPAT - Will convert double-quotes and leave single-quotes alone. Why is that the default and not: ENT_QUOTES - Will convert both double and single quotes. Also, what does 'ENT' refer to here? Thanks. |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On Thu, 28 Feb 2008 15:51:23 +0100, Jerry <Jerry@nospam.not> wrote:
> The manual says that the default parameter is: > > ENT_COMPAT - Will convert double-quotes and leave single-quotes alone. > > Why is that the default and not: > > ENT_QUOTES - Will convert both double and single quotes. Because by default, most people use double quotes for their tag attributes rather then single quotes (which are just as valid offcourse). In most circumstances, you don't want both (for instance, setting an onclick attribute on a tag in double quotes: you want the double quotes as entities, converting the single quotes will usually end up destroying the javascript in there. > Also, what does 'ENT' refer to here? Thanks. ENTities -- Rik Wasmus |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
Rik Wasmus wrote:
> (for instance, setting an onclick attribute on a tag in double quotes: > you want the double quotes as entities, converting the single quotes > will usually end up destroying the javascript in there. No it won't. <p onclick="window.alert('Hello' ;">Say hello</p><p onclick="window.alert('Hello');">Say hello</p> should both act exactly the same. The Javascript interpreter never sees the "'" -- it is converted to a single quote mark by the HTML parser before passing it on to the scripting engine. -- Toby A Inkster BSc (Hons) ARCS [Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux] [OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 29 days, 21:42.] Bottled Water http://tobyinkster.co.uk/blog/2008/02/18/bottled-water/ |
|
![]() |
| Outils de la discussion | |
|
|