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

<br> are getting children... #57

Closed
UncleGringo opened this issue May 8, 2012 · 3 comments
Closed

<br> are getting children... #57

UncleGringo opened this issue May 8, 2012 · 3 comments

Comments

@UncleGringo
Copy link

Not sure if this is an issue for here , Htmlparser2, or I am just clueless but whenever I pull in a doc with cheerio and there is code like

<br> <span> blah</span> <br>

that first br is going to get 2 children of span and br....

I thought this wasn't supposed to happen for nodes like br who can't have children when the xmlMode option is false.... or am I just confused...

UG

@davidchambers
Copy link
Contributor

It looks as though your <br /> is being treated as a line break. Can you edit your comment, indenting the example by four spaces so that it’s visible when rendered?

@UncleGringo
Copy link
Author

Fixed... sorry had to encode my example.. it was being interpreted as html

@davidchambers
Copy link
Contributor

I can't reproduce this. Here's what I get:

> $('<br> <span> blah</span> <br>').first()
{ '0': 
  { type: 'tag',
    name: 'br',
    attribs: {},
    parent: 
    { type: 'root',
      name: 'root',
      parent: null,
      prev: null,
      next: null,
      children: [Object] },
    prev: null,
    next: 
    { data: ' ',
      type: 'text',
      parent: [Object],
      prev: [Circular],
      next: [Object] },
    children: [] },
  length: 1 }

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

3 participants