Closed
Bug 914545
Opened 11 years ago
Closed 11 years ago
"undefined entity" error triggered from JavaScript in XHTML page
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: vpycha, Unassigned)
References
()
Details
User Agent: Mozilla/5.0 (X11; Linux i686; rv:23.0) Gecko/20100101 Firefox/23.0 (Beta/Release)
Build ID: 20130814063812
Steps to reproduce:
I had a page served with "application/xhtml+xml" MIME type, with XHTML 1.0 Transitional doctype with an FPI (Formal Public Identifier).
Actual results:
XHTML entities normally worked, except that I was getting a pair of runtime JavaScript errors whenever I was assigning to either of properties element.innerHTML or element.outerHTML a string containing containing an XHTML entity, in particular " " entity. The script was inside a CDATA section.
The pair of JavaScript errors were:
undefined entity
SyntaxError: An invalid or illegal string was specified
After I removed the entity from the string, I was getting neither of these errors.
Expected results:
No JavaScript errors should have occurred.
Reporter | ||
Updated•11 years ago
|
Reporter | ||
Comment 1•11 years ago
|
||
I created a test case, see the URL above.
Now I tested it in Google Chrome and Internet Explorer 9 and the results were the same, the same errors occurred.
So, which RFC dictates that browsers should behave this way that does not make sense?
Do I really have to be using " " entity in my scripts instead of " " and have to tell Google to do so too in their Custom Search scripts?
Reporter | ||
Comment 2•11 years ago
|
||
A related question and answer at stackoverflow:
http://stackoverflow.com/questions/4162270/dom-exception-when-assigning-html-entities-to-innerhtml
Updated•11 years ago
|
Assignee: nobody → general
Component: Untriaged → JavaScript Engine
Product: Firefox → Core
Comment 3•11 years ago
|
||
> So, which RFC dictates that browsers should behave this way
The relevant spec is http://domparsing.spec.whatwg.org/#extensions-to-the-element-interface which calls http://domparsing.spec.whatwg.org/#concept-parse-fragment which calls http://www.whatwg.org/specs/web-apps/current-work/multipage/the-xhtml-syntax.html#xml-fragment-parsing-algorithm
It looks like we're correctly doing what this says: it never says to import the context element's document's DTD into the new XML parser. In fact the spec clearly says this is purposeful:
Note: If there is a context element, no DOCTYPE is passed to the parser, and
therefore no external subset is referenced, and therefore no entities will be
recognized.
If you think the spec here should change, please raise a spec issue...
Assignee: general → nobody
Status: UNCONFIRMED → RESOLVED
Closed: 11 years ago
Component: JavaScript Engine → DOM: Core & HTML
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•