hpricot/hpricot — pull request #60 by smparkes (2012-01-12 19:41:41+00:00)
Title: Liberally handle unknown elements

As it stands, hpricot is very conservative about element content models. It assumes the content model of any unknown element is text only and unknown elements are not allowed in most known elements.

This is particularly problematic with html5: hpricot doesn't know the new html5 tag set.

In theory, hpricot could be taught the html5 spec (though it's a moving target ...) But that wouldn't change the fact that hpricot isn't really following what browsers do (liberally ignore unknown tags) and doesn't seem like it fits the spirit of hpricot's goal of being a good html cleaner-upper.

So this patch simply makes the content model of unknown elements anything and allows any element to contain unknown elements. I think this matches what browsers do.