Skip to content

fixed exception error when a single-character attribute name is included - #5

Open
bokutin wants to merge 1 commit into
kentfredric:masterfrom
bokutin:topic/invalid_attribute_name
Open

fixed exception error when a single-character attribute name is included#5
bokutin wants to merge 1 commit into
kentfredric:masterfrom
bokutin:topic/invalid_attribute_name

Conversation

@bokutin

Copy link
Copy Markdown

The specification and code do not match.

spec

https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-Name
Name ::= NameStartChar (NameChar)*

code

return (0) unless ( $attr =~ /^$START_CHAR$NAME_CHAR+$/ );

The one-liner that causes this error.

% perl -e "use HTML::TreeBuilder; HTML::TreeBuilder->new->parse_content('<span v="1"></span>')->as_XML"
span has an invalid attribute name 'v' at -e line 1.

The specification and code do not match.
spec
https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-Name
Name ::= NameStartChar (NameChar)*
code
lib/HTML/Element.pm:4403
$attr =~ /^$START_CHAR$NAME_CHAR+$/
The one-liner that causes this error.
perl -e "use HTML::TreeBuilder; HTML::TreeBuilder->new->parse_content('<span v="1"></span>')->as_XML"
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@bokutin