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

Which code printed this error to the console "element _: validity error : ID _ already defined" #79

Closed
chengguangnan opened this issue Nov 21, 2014 · 4 comments

Comments

@chengguangnan
Copy link

I try to find a way to silent those messages but could not locate the code in loofah or nokogiri.

Any idea where does it come from? libxml?

> Loofah.document("<i id=a></i><i id=a></i>").to_text
element i: validity error : ID a already defined
@chengguangnan
Copy link
Author

I found it related by the #dup method here.

https://github.com/flavorjones/loofah/blob/master/lib/loofah/instance_methods.rb#L116

self.dup.scrub!(:newline_block_elements).text(options)

Demo:

irb(main):032:0> d.text
=> ""
irb(main):033:0> d.dup.text
element i: validity error : ID a already defined
=> ""

@chengguangnan
Copy link
Author

I can confirm the same behavior on Nokogiri.

Nokogiri::HTML("<i id=a></i><i id=a></i>").dup.text
element i: validity error : ID a already defined
=> ""

@flavorjones
Copy link
Owner

Closing, as you've opened a Nokogiri bug to track this issue.

@flavorjones
Copy link
Owner

This will be fixed in Nokogiri 1.6.5, out soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants