-
Notifications
You must be signed in to change notification settings - Fork 27
Ensure every Locator is also a Locator2 #10
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
Conversation
Sorry for the delay in reviewing this. In my environment, when testing this with the HTML checker code, this change causes the HTML checker to fail at runtime with the following:
|
My apologies - I missed the use of "org.xml.sax.helpers.LocatorImpl" to create an empty Locator for use in a DocumentFragment. I've changed this to use an empty "nu.validator.htmlparser.impl.LocatorImpl" instead, it should fix the problem. |
OK, yup, it works as excepted for me now @hsivonen Do you have time to review this patch? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. It looks like some small changes are needed.
r+. Thank you. @sideshowbarker I let you push the merge button, since you know the practices of this fork better. Once landed here, I'm then going to upstream the changeset. (I really should figure out the process of moving the upstream repo from https://hg.mozilla.org/projects/htmlparser/ under https://github.com/mozilla/ to make it all happen within git and GitHub.) |
That would be great :) That’d make it easier to keep the fork up to date, as well. (Currently I do it using hg-git to pull the upstream changes from the mercurial repo and merge them into the git repo for the fork.) |
* Replace org.xml.sax.helpers.LocatorImpl with nu.validator.htmlparser.impl.LocatorImpl * instanceof before cast to Locator2
* Replace org.xml.sax.helpers.LocatorImpl with nu.validator.htmlparser.impl.LocatorImpl * instanceof before cast to Locator2
* Replace org.xml.sax.helpers.LocatorImpl with nu.validator.htmlparser.impl.LocatorImpl * instanceof before cast to Locator2
* Replace org.xml.sax.helpers.LocatorImpl with nu.validator.htmlparser.impl.LocatorImpl * instanceof before cast to Locator2
* Replace org.xml.sax.helpers.LocatorImpl with nu.validator.htmlparser.impl.LocatorImpl * instanceof before cast to Locator2
* Replace org.xml.sax.helpers.LocatorImpl with nu.validator.htmlparser.impl.LocatorImpl * instanceof before cast to Locator2
* Replace org.xml.sax.helpers.LocatorImpl with nu.validator.htmlparser.impl.LocatorImpl * instanceof before cast to Locator2
* Replace org.xml.sax.helpers.LocatorImpl with nu.validator.htmlparser.impl.LocatorImpl * instanceof before cast to Locator2
* Replace org.xml.sax.helpers.LocatorImpl with nu.validator.htmlparser.impl.LocatorImpl * instanceof before cast to Locator2
@faceless2, are you OK with the way authorship is recorded in the mechanical Gecko tree import of this patch: https://github.com/hsivonen/gecko/commit/46bc6514cee5531b7e7c8da7e704a4178afc6b6b.patch ? |
Ha, of course - thanks for asking though. |
* Replace org.xml.sax.helpers.LocatorImpl with nu.validator.htmlparser.impl.LocatorImpl * instanceof before cast to Locator2
* Replace org.xml.sax.helpers.LocatorImpl with nu.validator.htmlparser.impl.LocatorImpl * instanceof before cast to Locator2
* Replace org.xml.sax.helpers.LocatorImpl with nu.validator.htmlparser.impl.LocatorImpl * instanceof before cast to Locator2
* Replace org.xml.sax.helpers.LocatorImpl with nu.validator.htmlparser.impl.LocatorImpl * instanceof before cast to Locator2
* Replace org.xml.sax.helpers.LocatorImpl with nu.validator.htmlparser.impl.LocatorImpl * instanceof before cast to Locator2
* Replace org.xml.sax.helpers.LocatorImpl with nu.validator.htmlparser.impl.LocatorImpl * instanceof before cast to Locator2
This pull request will ensure every org.xml.sax.Locator created by this package also implements org.xml.sax.ext.Locator2. This extended interface (added in Java 5) allows you to retrieve the encoding of the InputSource.
The encoding is important, as it's the default encoding used for CSS imports, and as the HtmlParser will sniff the encoding from an embedded
<meta charset>
element, it can't easily be retrieved any other way.The PR casts Locator to Locator2 in many places, but as every class that implements Locator in this package also implements Locator2, this is safe.