Single-quoted attributes are being replaced with double-quoted without proper escaping #85

Closed
TEHEK opened this Issue Aug 16, 2012 · 4 comments

Comments

Projects
None yet
4 participants
@TEHEK

TEHEK commented Aug 16, 2012

 $ = cheerio.load('<h2 class = \'a very "new" title\'>Hello world</h2>');

$.html(); // <h2 class="a very "new" title">Hello world</h2>

IMO, it should either preserve quotes or apply proper escaping.

@sindresorhus

This comment has been minimized.

Show comment Hide comment
@sindresorhus

sindresorhus Aug 17, 2012

Contributor

The output should IMO be: <h2 class="a very 'new' title">Hello world</h2>

Contributor

sindresorhus commented Aug 17, 2012

The output should IMO be: <h2 class="a very 'new' title">Hello world</h2>

@TEHEK

This comment has been minimized.

Show comment Hide comment
@TEHEK

TEHEK Aug 19, 2012

IMO, it is important that EXACT value of an attribute is preserved. So, it either should be

<h2 class='a very "new" title'>Hello world</h2>

or

<h2 class="a very &quot;new&quot; title">Hello world</h2>

TEHEK commented Aug 19, 2012

IMO, it is important that EXACT value of an attribute is preserved. So, it either should be

<h2 class='a very "new" title'>Hello world</h2>

or

<h2 class="a very &quot;new&quot; title">Hello world</h2>
@jugglinmike

This comment has been minimized.

Show comment Hide comment
@jugglinmike

jugglinmike Aug 5, 2013

Member

I think this issue can be closed. I just tested this with v0.12.1, and it now behaves as per @TEHEK's example:

console.log(                                                                    
  cheerio.load('<h2 class = \'a very "new" title\'>Hello world</h2>').html()    
);

yields

<h2 class="a very &quot;new&quot; title">Hello world</h2>
Member

jugglinmike commented Aug 5, 2013

I think this issue can be closed. I just tested this with v0.12.1, and it now behaves as per @TEHEK's example:

console.log(                                                                    
  cheerio.load('<h2 class = \'a very "new" title\'>Hello world</h2>').html()    
);

yields

<h2 class="a very &quot;new&quot; title">Hello world</h2>
@matthewmueller

This comment has been minimized.

Show comment Hide comment
@matthewmueller

matthewmueller Aug 5, 2013

Member

<3

Member

matthewmueller commented Aug 5, 2013

<3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment