This project is archived and is in readonly mode.
HTML::Document#initialize Node.parse call missing strict argument
Reported by Jimmy Baker | June 4th, 2008 @ 07:27 PM | in 2.1.1
While working on a screen-scraping application using scrAPI, I noticed some parser exceptions when using the gem with Rails. With the help of Scott White, we were able to track down the source of the exceptions.
Looking at line 20 of actionpack-2.1.0/lib/action_controller/vendor/html-scanner/html/document.rb you'll notice the following method call:
node = Node.parse(node_stack.last, tokenizer.line, tokenizer.position, token)
I think this method call should actually be..
node = Node.parse(node_stack.last, tokenizer.line, tokenizer.position, token, strict)
The local variable 'strict' is passed in as an argument and defaults to false. Passing this parameter on to the Node.parse call will stop the method from throwing exceptions when bad markup is attempting to parse.
Comments and changes to this ticket
-
Jimmy Baker June 4th, 2008 @ 05:02 PM
Certainly. The following pastie shows my code and the exceptions that are produced from it:
-
jdwyah June 12th, 2008 @ 06:51 PM
+1. Google Website Optimizer script tags break my assert_select calls without this.
-
Jeremy Kemper June 16th, 2008 @ 12:27 PM
- Milestone set to 2.1.1
- State changed from new to open
- Assigned user set to Jeremy Kemper
-
Jeremy Kemper June 23rd, 2008 @ 02:47 AM
- State changed from open to incomplete
The change looks good, but needs test coverage.
Could you write up a patch with a test case?
-
Jimmy Baker June 25th, 2008 @ 06:28 AM
Patch attached. The patch includes the fix along with two tests.
-
Jeremy Kemper June 25th, 2008 @ 06:40 AM
- State changed from incomplete to open
Thanks! Want to adjust your email address in your global git config and resubmit before I apply?
-
Jimmy Baker June 25th, 2008 @ 06:55 AM
Oops! Thanks for noticing. Email updated. The revised patch is attached.
-
Repository June 25th, 2008 @ 07:14 AM
- State changed from open to resolved
(from [02ffbc27637db50b7c663d367d0f4712738b0aae]) Patched HTML::Document#initialize call to Node.parse so that it includes the strict argument. [#330 state:resolved]
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>