WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
26133
Adapt and import py-dom-xpath tests
https://bugs.webkit.org/show_bug.cgi?id=26133
Summary
Adapt and import py-dom-xpath tests
Alexey Proskuryakov
Reported
2009-06-02 08:36:24 PDT
<
http://code.google.com/p/py-dom-xpath/
> is a Python implementation of XPath 1.0, and it comes with a test suite that we could convert into JavaScript. The code is under MIT License. Patch forthcoming.
Attachments
proposed patch
(77.48 KB, patch)
2009-06-02 09:11 PDT
,
Alexey Proskuryakov
sam
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Alexey Proskuryakov
Comment 1
2009-06-02 09:11:44 PDT
Created
attachment 30869
[details]
proposed patch This also fixes some minor bugs found with the test suite.
Sam Weinig
Comment 2
2009-06-02 10:27:37 PDT
Comment on
attachment 30869
[details]
proposed patch
> + Fix bugs found with this test suite: > + - name and local-name were incorrect for processing instructions (XPath expanded-name > + doesn't match DOM exactly); > + - name, local-name and namespace functions sould crash on attribute nodes;
Typo: "sould"
> + which doesn't match anything available via DOM exactly. Calculate the expanded name properly. > + (WebCore::XPath::FunNamespaceURI::evaluate): This function could crash if used with an > + attribute node, because it released what was possibly the only reference to attribute node > + before using it. Changed the fucntion to avoid such situation.
Typo: "fucntion"
> + > + // String::toDouble() supports exponential notation, which is not allowed in XPath. > + unsigned len = str.length(); > + for (unsigned i = 0; i < len; ++i) { > + UChar c = str[i]; > + if ((c < '0' || c > '9') && c != '.' && c != '-')
Can we use isASCIIDigit here? r=me
Alexey Proskuryakov
Comment 3
2009-06-02 11:00:33 PDT
Committed revision 44361.
> Can we use isASCIIDigit here?
We can!
Darin Adler
Comment 4
2009-06-02 12:29:33 PDT
Comment on
attachment 30869
[details]
proposed patch
> + unsigned len = str.length(); > + for (unsigned i = 0; i < len; ++i) { > + UChar c = str[i]; > + if ((c < '0' || c > '9') && c != '.' && c != '-') > + return numeric_limits<double>::quiet_NaN(); > + }
I'd like to see this in a helper function, just because the name of that function might be a useful bit of documentation.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug