Code Monkey home page Code Monkey logo

Comments (7)

GoogleCodeExporter avatar GoogleCodeExporter commented on May 20, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 20, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 20, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 20, 2024
(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.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 20, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 20, 2024
...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.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 20, 2024
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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.