Closed Bug 980204 Opened 12 years ago Closed 9 years ago

Inspector doesn't escape entities in HTML attributes

Categories

(DevTools :: Inspector, defect, P3)

x86_64
Linux
defect

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: billm, Assigned: zer0)

Details

Attachments

(1 file)

If I create a web page that contains: <input id="foo" value=""></input> and then I run this code: $("#foo").val("&quot;"); then the page will contain an input element that displays the string '&quot;'. If I then look at that element in the inspector, it shows: <input id="foo" value="&quot;"></input> However, if I put *that* HTML directly in a web page, the input element will display '"'. I think instead the inspector should show this: <input id="foo" value="&amp;quot;"></input>
Filter on CLIMBING SHOES
(In reply to Bill McCloskey (:billm) from comment #0) > However, if I put *that* HTML directly in a web page, the input element will > display '"'. I think instead the inspector should show this: I wasn't able to reproduce exactly the behavior described; not sure what Bill means with "if I put that HTML directly in a web page", I assumed you mean if you create the page with that HTML as source. If I do that, the input element won't display '"', but still "&quote;". Maybe the behavior changed since this bug was filed. Bill, could you provide more info about it? But, despite that, there is something odds anyway. When we have a page containing: <input id="foo" value="&quot;"></input> If we enter in "Edit as HTML" mode, the code showing will be: <input id="foo" value="&amp;quot;"></input> Probably because it encodes the entity. However, it doesn't really matter if we leave as is or change to "&quote;", the result will be the one expected. We should probably fix that.
Flags: needinfo?(wmccloskey)
Priority: -- → P3
Attached file test.html
When I visit this page, I see a text field containing '"'. Is that different from what you see?
Flags: needinfo?(wmccloskey) → needinfo?(zer0)
Assignee: nobody → zer0
Flags: needinfo?(zer0)
(In reply to Bill McCloskey (:billm) from comment #3) > When I visit this page, I see a text field containing '"'. Is that different > from what you see? No, you're right. I probably did something different. However, since it seems consistent with the other browsers' devtools, I'm not sure we want to change this behavior.
Sorry if you didn't hear from me sooner; if you have some specific use case in mind that you think makes worthy to diverge from the others devtools let me know! Otherwise I think we should resolve this bug as invalid.
Flags: needinfo?(wmccloskey)
What other devtools is this consistent with? I just tested in Chrome and it doesn't have this bug. If I select the element and choose "Edit as HTML", it displays the attribute as "&amp;quot;".
Flags: needinfo?(wmccloskey) → needinfo?(zer0)
(In reply to Bill McCloskey (:billm) from comment #6) > What other devtools is this consistent with? Chrome and Safari is the ones I tested. I'm referring to what you said in comment 3: >> When I visit this page, I see a text field containing '"'. Is that different from what you see? Loading the attachment in Firefox, Safari and Chrome, I have the same result: in the viewsource I have `&quote;` but both in the browser (of course) and in the inspector/markup view, I see `"`. > I just tested in Chrome and it > doesn't have this bug. If I select the element and choose "Edit as HTML", it > displays the attribute as "&amp;quot;". If I load the attachment you added, and I inspect the element with Firefox, Safari and Chrome, and then I choose "Edit as HTML", I got the same behavior in all three browsers (All of them show me a textarea with `<input id="foo" value="&quot;">`). So, maybe I missed something about the STR, or I didn't catch quite the issue here, but so fare they seems consistent to me. I tried to describe as better I could my steps to reproduce the issue, so if I missed something please let me know! (Note: I'm on OSX, I believe you're on Linux; currently I can't test on Linux, but if the STR are the same and we got two different result, it could be platform dependent.)
Flags: needinfo?(zer0) → needinfo?(wmccloskey)
I just tested again and it looks like this works in Firefox now.
Status: NEW → RESOLVED
Closed: 9 years ago
Flags: needinfo?(wmccloskey)
Resolution: --- → WORKSFORME
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: