Comments (7)
Well, I found the code. ^^'
http://code.google.com/p/wicked-good-xpath/source/browse/trunk/functionCall.js
Line 345:
LOCAL_NAME: wgxpath.FunctionCall.createFunc_('local-name',
wgxpath.DataType.STRING, false, true, false,
function(ctx, opt_expr) {
var node = opt_expr ? opt_expr.evaluate(ctx).getFirst() : ctx.getNode();
return node ? node.nodeName.toLowerCase() : '';
}, 0, 1, true),
I would just go ahead and fix this, but I'd like someone to verify that, yes,
local-name SHOULD return DOM's localName instead of the potentially prefixed
nodeName.
Original comment by [email protected]
on 8 Apr 2014 at 5:50
- Added labels: ****
- Removed labels: ****
from wicked-good-xpath.
Thanks for the report. Please attach a sample HTML page to this issue on which
the bug can be reproduced.
Original comment by [email protected]
on 8 Apr 2014 at 8:10
- Added labels: ****
- Removed labels: ****
from wicked-good-xpath.
Here you go.
This HTML page contains some prefixed nodes, and then outputs their respective
local-names and names.
As a bonus, each node tries to query itself using the syntax
"self::ns:element", which doesn't work in wgxpath and seems to be related to
this local-name thing.
The output in Firefox, Chrome and Opera is:
<wgx:element>
[object Element]
XPath local-name():
element
DOM localName:
element
XPath name():
wgx:element
DOM nodeName:
wgx:element
XPath self::wgx:element:
[object Element]
(Which, as far as I can tell, is in accordance with the spec.)
Whereas the output in IE11 is:
<wgx:element>
[object Element]
local-name():
wgx:element
DOM localName:
element
name():
wgx:element
DOM nodeName:
wgx:element
self::wgx:element:
null
(I am especially bugged by the last point, since that is what is currently
breaking my app. ^^')
Thanks for looking into this!
Original comment by [email protected]
on 9 Apr 2014 at 10:52
- Added labels: ****
- Removed labels: ****
Attachments:
from wicked-good-xpath.
(Ah, that last comment was by me, forgot to switch accounts, sorry. ^^')
Original comment by [email protected]
on 9 Apr 2014 at 11:11
- Added labels: ****
- Removed labels: ****
from wicked-good-xpath.
For this bug to be exhibited the document has to be XML (like XHTML) not HTML,
so this falls partially under the "support for XML documents" feature request.
This is fairly low-hanging fruit to fix, though, so I'll do it, and then maybe
make further progress toward completing that feature request.
Original comment by [email protected]
on 9 Apr 2014 at 2:47
- Changed state: Accepted
- Added labels: ****
- Removed labels: ****
from wicked-good-xpath.
...oh. Sorry, it's been a while since I've worked with text/html, I wasn't even
aware that XPath's functions (or the DOM attributes related to them) behave
differently there.
For the sake of completion, here is the same test case as HTML. Here, wgxpath
does indeed behave almost identical to the XPath Implementations of Firefox and
company.
Namely, the namespace prefix is part of the local name, and querying by prefix
doesn't work. Differences in upper/lowercase fall under HTML's YOLO philosophy,
I guess.
Original comment by [email protected]
on 9 Apr 2014 at 3:57
- Added labels: ****
- Removed labels: ****
Attachments:
from wicked-good-xpath.
Fixed in the latest install file.
Original comment by [email protected]
on 22 Jul 2014 at 5:35
- Changed state: Fixed
- Added labels: ****
- Removed labels: ****
from wicked-good-xpath.
Related Issues (20)
- Running unit tests and integration tests HOT 9
- Precompiled wgxpath.install.js contains loads of extra comments HOT 1
- Wildcard on element step returns 0 results HOT 1
- Comparison arguments inverted in `primitive <op> nodeset` case. HOT 1
- Bulid with Closure Compiler's official NPM package
- TypeError: 'localName' is null or not an object HOT 1
- How to use within Node and Browser HOT 8
- Attr no longer innherits from Node in DOM4: breaks wgxpath.NodeSet.merge HOT 2
- Tag name production is too strict
- XML descendant problem HOT 3
- bower main HOT 1
- wgxpath cannot evaluate upper case. HOT 8
- wgxpath doesn't work with textarea tag after changing input value HOT 3
- add dist folder
- Need Wiki/Doc about WGXPath HOT 3
- Can't resolve anything but DIV in a specific scenario(JS FIDDLE Attached) HOT 2
- createRange function missing with jsdom 15.2.0 HOT 1
- How to use in react project HOT 6
- Library status?
- Simple XPath with namespaces not working
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wicked-good-xpath.