Skip to content
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

(jruby) Fix Node#line #2177

Merged
merged 3 commits into from Jan 19, 2021
Merged

(jruby) Fix Node#line #2177

merged 3 commits into from Jan 19, 2021

Commits on Jan 18, 2021

  1. Copy the full SHA
    5ac6348 View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    369e6bd View commit details
    Browse the repository at this point in the history
  3. fix(jruby): improve how Node#line is calculated

    Note that Java's w3c.dom.Node interface does not have any way to
    get (or set) the line number for that node. The original JRuby
    implementation counted newlines, but did it poorly -- see #1223.
    
    This commit improves the newline-counting approach. But the solution
    itself -- counting newlines! -- is still questionable IMHO and
    absolutely inefficient.
    
    I had played around with an approach that I wrote about at #1223,
    where the SAX Parser knows what line it's on when `startElement` is
    invoked (via the XMLLocator). But I couldn't figure out how to
    preserve that information in the final Document or Node.
    
    If you, like me, think this approach is terrible; and if you *also*
    understand how to set this metadata on the Node or the Document, then
    please help us out.
    flavorjones committed Jan 18, 2021
    Copy the full SHA
    b32c875 View commit details
    Browse the repository at this point in the history