Closed Bug 899375 Opened 12 years ago Closed 12 years ago

Inspector attributes get removed if the name contains a colon

Categories

(DevTools :: Inspector, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 26

People

(Reporter: bgrins, Assigned: bgrins)

References

Details

Attachments

(1 file, 1 obsolete file)

Open this page: https://hg.mozilla.org/mozilla-central/rev/eaeff37cbffc. Inspect element. Double click on the html element's attribute xml:lang="en-US". Click out. Attribute disappears. Also fails in a basic case like so: <html> <body one:two="3"> </body> </html>
Also happens on the src attribute with this markup: <img alt="Red dot" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="></img>
Blocks: 893677
(In reply to Brian Grinstead [:bgrins] from comment #2) > Blocks: 893677 If you typed bug 893677 it would be linked. Anyhow, you should type blocked bug numbers in the "Blocks" field above.
Blocks: 893677
Assignee: nobody → bgrinstead
(In reply to Brian Grinstead [:bgrins] from comment #1) > Also happens on the src attribute with this markup: > > <img alt="Red dot" > src="data:image/png;base64, > iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/ > w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="></img> This is actually due to the value ending in an = sign. The parser in escapeAttributeValues is matching on =". I'm wondering if it would make sense to parse the attributes out a little differently using the DOM or something like: https://developer.mozilla.org/en-US/docs/Code_snippets/HTML_to_DOM. Maybe something like this: +function escapeAttributeValues(attr, aAttrNode) { + + let div = aAttrNode.ownerDocument.createElement("div"); + div.innerHTML = "<div " + attr + "></div>"; + + var attributes=[]; + var el = div.childNodes[0]; + for (var i=0, l=el.attributes.length; i<l; i++){ + let attr = el.attributes.item(i) + attributes.push({name:attr.nodeName, value: attr.nodeValue}); + } + + return attributes; +} It is possible that this could change the behavior when someone actually types one of the reserved characters into the attribute (< > ")
Attached patch bug-899375-attributes.patch (obsolete) — Splinter Review
Attachment #787132 - Flags: review?(mratcliffe)
Please review this one, instead
Attachment #787132 - Attachment is obsolete: true
Attachment #787132 - Flags: review?(mratcliffe)
Attachment #787499 - Flags: review?(mratcliffe)
Attachment #787499 - Flags: review?(mratcliffe) → review+
Whiteboard: [land-in-fx-team]
Blocks: 904049
Joe, Can you please land this patch?
Flags: needinfo?(jwalker)
Whiteboard: [land-in-fx-team] → [fixed-in-fx-team]
Flags: needinfo?(jwalker)
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 26
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: