-
Notifications
You must be signed in to change notification settings - Fork 864
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bugfix for parsing xml that starts with whitespace #7
base: master
Are you sure you want to change the base?
Conversation
Ie. without the patch: js> (new XML(" <a/>")).toSource() <a/> and with the patch: js> (new XML(" <a/>")).toSource() <a/> - unit test also added. In the same time it changes the way xml for booleans/numbers are made to be actually parsed rather than built as a text-node with a special case.
trim leading/trailing space within xml-textnodes as in spidermonkey and ecma-357Added another patch+unittest on whitespace and e4x: Rhino treats leading/trailing whitespaces in e4x differently from SpiderMonkey, with
where the latest SpiderMonkey does:
The second commit changes Rhinos behaviour, such that leading/trailing spaces are not trimmed when building/trimming the xml-tree, but is trimmed when prettyprinting, - which seems to be same behaviour as SpiderMonkey and in the e4x-standard. |
Would be great to have this patch merged - we do a lot of E4X manipulations using Rhino, and could use this patch (disclaimer: from same org. as Rasmus). |
What is the status of this, |
…ions for easier profiling
Converted to draft as this has been lying around since forever and needs someone to go through to determine whether we want/needs this PR not |
Rhino has problems when parsing xml that starts with whitespace (and
XML.ignoreWhitespace === true
), ie:This patch fixes this issues such that:
Unit test also added.
This is implemented by removing the special case for strings not starting with
<
. According to ECMA-357 10.3, numbers and booleans are passed to the same xml-conversion as strings, so as far as I can see the special case is not needed.