Skip to content

Insufficient validation on tag names? #16

Closed

Description

@Arithmomaniac

I can't reproduce this with a code snippet, but I got

TABLE
BORDER=0

for node.TagName and

<table border=0 cellspacing="2" cellpadding="2" width="100%">...</table
border=0>

for node.ElementHtml(). (Yes, with the line breaks.)

Something tells me that doesn't satisfy the HTML5 parsing rules... by then again, I've never read them. [:-)] Either way, you may want something for it in your tests.

Activity

  1. jamietre commented on Jun 28, 2012

    @jamietre
    Owner

    Interesting.. space should be a stopper no matter what, but the rules for a valid tag name are pretty liberal -- maybe it was a shift-space or something? If you can repro it definitely post the markup. I'll play a bit with that tomorrow too.

    It may be I'm not permitting enough whitespace as stoppers in the tag name. I have tests for other situations like class name separators, not sure this has come up before. (like the first thing after the tag name being a linefeed)

  2. added a commit that references this issue on Jun 29, 2012
  3. jamietre commented on Jun 29, 2012

    @jamietre
    Owner

    OK, fixed. I was not checking for all valid whitespace after tag names, this works:

        [Test, TestMethod]
        public void NewLinesInTags()
        {
            string test = @"<table 
                border
                =0 cellspacing=
                ""2"" cellpadding=""2"" width=""100%""><span"+(char)10+"id=test></span></table>";
            var dom = CQ.CreateFragment(test);
    
            var output = dom.Render();
            Assert.AreEqual(
                @"<table border=""0"" cellspacing=""2"" cellpadding=""2"" width=""100%""><span id=""test""></span></table>",
                output);
        }
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions