tenderlove/nokogiri — Issue #562: Nokogiri adds id attribute with XHTML doctype
Author: TeamIguana
Created: 2011-11-04 11:04:36+00:00
State: open

Hi,
we have found a strange issue in Nokogiri (latest version).

Using this code:

```ruby
html = Nokogiri::XML::Builder.new do |html|
html.doc.create_internal_subset(
'html',
'-//W3C//DTD XHTML 1.0 Transitional//EN',
'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'
)
html.html {
html.body {
html.a(:href=>'url', :name=>'name')
}
}
end
p html.doc.to_s
```

the resulting HTML will be:

```

```

as you can see, the anchor has an additional id attribute that was not given.

However, if we remove the doctype definition it doesn't get added.

How come?

Thanks,
Team Iguana