Bug 25893
Summary: | createElement should support passing markup instead of just element name, e.g. document.createElement("<select readonly>") | ||
---|---|---|---|
Product: | WebKit | Reporter: | Lúcio Flávio Corrêa <lucio.correa> |
Component: | DOM | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED CONFIGURATION CHANGED | ||
Severity: | Normal | CC: | ahmad.saleem792, ap, bfulgham, enqd, evan, ian, lucio.correa, Ms2ger, rniwa |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | All | ||
OS: | All |
Lúcio Flávio Corrêa
Hey Guys. I'm trying to access a website (www.minhacasaminhavida.pe.gov.br) but webkit based browsers doesn't work with that. This is the message returned by WebInpector:
INVALID_CHARACTER_ERR: DOM Exception 5
HTMLComponents.js:1962Error: INVALID_CHARACTER_ERR: DOM Exception 5
The file location is http://www.minhacasaminhavida.pe.gov.br/pmc/components/HTMLComponents.js
Thanks in Advance
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Lúcio Flávio Corrêa
(In reply to comment #0)
> Hey Guys. I'm trying to access a website (www.minhacasaminhavida.pe.gov.br) but
> webkit based browsers doesn't work with that. This is the message returned by
> WebInpector:
>
> INVALID_CHARACTER_ERR: DOM Exception 5
> HTMLComponents.js:1962Error: INVALID_CHARACTER_ERR: DOM Exception 5
>
> The file location is
> http://www.minhacasaminhavida.pe.gov.br/pmc/components/HTMLComponents.js
>
> Thanks in Advance
>
Ah, forgot to add that it works in Firefox and IE too.
Alexey Proskuryakov
Believe it or not, but Firefox successfully creates a SELECT element with document.createElement("<select>"). IE has a separate code path.
Eric Seidel (no email)
Seems we should file a bug with mozilla.
Alexey Proskuryakov
IE even supports document.createElement("<select readonly>"), but Firefox does not.
My guess is that Firefox had to partially implement this IE quirk for web compatibility.
Alexey Proskuryakov
*** Bug 44841 has been marked as a duplicate of this bug. ***
Alexey Proskuryakov
Another example of a broken site in duplicate bug.
Evan Martin
Alexey's guess in comment 4 is correct:
Mozilla bug discussing the problem:
https://bugzilla.mozilla.org/show_bug.cgi?id=489532
Diff showing they added angle brackets:
http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/content/html/document/src/nsHTMLDocument.cpp&rev=3.791&mark=1459,1467-1473#1458
But it looks like they removed it in 2004:
http://hg.mozilla.org/mozilla-central/rev/ecdf587c02d0
Alexey Proskuryakov
> But it looks like they removed it in 2004:
> http://hg.mozilla.org/mozilla-central/rev/ecdf587c02d0
In fact, that's July 2010, just weird date formatting.
If Mozilla won't reconsider removing this quirk before shipping Firefox 4, we almost certainly don't want to add it.
Ms2ger (he/him; ⌚ UTC+1/+2)
I don't think Mozilla will add this quirk back. (At least, I'll do what I can to avoid it.)
Lúcio, any chance you could contact the website? The changes they need to make come down to changing document.createElement("<img>") to document.createElement("img"). (The ones that are guarded by isIE checks are probably not problematic.)
Ahmad Saleem
The test case from Mozilla Bug mentioned in Comment 07 behaves same across all browsers:
Link - http://software.hixie.ch/utilities/js/live-dom-viewer/?%3Cscript%3Ew%28document.createElement%28%22%3Cx%3E%22%29%29%3C%2Fscript%3E
** Safari 15.6 on macOS 12.5 **
error: InvalidCharacterError: The string contains invalid characters. on line 1
rendering mode: BackCompat
document has no title
** Firefox Nightly 105 **
error: InvalidCharacterError: String contains an invalid character on line 1
rendering mode: BackCompat
document has no title
** Chrome Canary 106 **
error: Uncaught InvalidCharacterError: Failed to execute 'createElement' on 'Document': The tag name provided ('<x>') is not a valid name. on line 1
rendering mode: BackCompat
document has no title
____
Since all browsers are now matching with each other, I am going to mark this as "RESOLVED CONFIGURATION CHANGED". Please reopen, if I have mark it as wrong. Thanks!