Closed
Bug 108609
Opened 23 years ago
Closed 23 years ago
Range.toString() contains JavaScript code
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: ajybhatia, Assigned: peterv)
References
()
Details
(Keywords: ecommerce, topembed, Whiteboard: topembed)
Attachments
(1 file)
613 bytes,
text/html
|
Details |
The string returned by Range.toString() should only contain text visible in the browser, IMO. However, it contains any JavaScript found within the Range, as well. Reproducibility: Every time. Steps to Reproduce: 1. Load the URL http://blues.mcom.com/users/ajybhatia/publish/RangeBugTestCase.htm in Mozilla. 2. Click on the button marked "Click Here". Actual Results: The alert that pops up displays Range.toString() for a Range that selects the contents of the Body node. This also displays JavaScript contained within the Body. Expected Results: The Range should only have the text "to see contents of Body node." No JavaScript should be part of the selected range.
Comment 1•23 years ago
|
||
Could you please attach the testcase to the bug? Testcases behind the firewall are really hard to work with if you're outside....
Status: UNCONFIRMED → NEW
Ever confirmed: true
Here is the source of the HTML referenced at the URL: <html> <head> <title>Range Bug TestCase</title> <script language=JavaScript> function displayRangeContents() { var Doc = window.content.document; var Range = Doc.createRange(); Range.selectNodeContents(Doc.body); alert("The body of this page contains: " + Range.toString()); } </SCRIPT> </head> <body> <script language=JavaScript> function dummyFunction() { // All sorts of cool stuff here... } </SCRIPT> <form> <input type=button value="Click Here" onClick="javascript:displayRangeContents()"> to see contents of Body node. </form> </body> </html>
Reporter | ||
Updated•23 years ago
|
reassigning to jst because nisheeth is on sabbatical.
Assignee: anthonyd → jst
Assignee | ||
Comment 5•23 years ago
|
||
I'm not convinced that that would be the right thing to do. The spec says: "One can get a copy of all the character data selected or partially selected by a Range with: DOMString toString(); This does nothing more than simply concatenate all the character data selected by the Range. This includes character data in both Text and CDATASection nodes." Note the *all* in the first sentence. Marking INVALID. If you disagree, reopen it.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → INVALID
The brand "M" browser engine provides access to a document's text (without javascript). Below is what we are trying to emulate: <HTML> <HEAD> <TITLE>Range Bug TestCase</TITLE> <SCRIPT language=JavaScript> function displayRangeContents() { var Range = document.body.createTextRange(); alert("The body of this page contains: " + Range.text); } </SCRIPT> </HEAD> <BODY> <SCRIPT language=JavaScript> function dummyFunction() { // All sorts of cool stuff here... } </SCRIPT> <FORM> <INPUT type=button value="Click Here" onClick="javascript:displayRangeContents()"> to see contents of Body node. </FORM> </BODY> </HTML>
We require this functionality for Mozilla for Quick Checkout Form Fill, a shipping product currently using IE.
Updated•11 years ago
|
Component: DOM: Traversal-Range → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•