Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Fixed err when .html and append use with null as input #670

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
2 participants
Contributor

AliMd commented Dec 29, 2012

Fixed err when .html and append use with null as input

  $('h1').append( $('.notfound').html() );

Ali Mihandoost added some commits Dec 29, 2012

Fixed err when .html and append use with null as input
$('h1').append( $('.notfound').html() );

@mislav mislav closed this in 7b2685d Jan 2, 2013

Collaborator

mislav commented Jan 2, 2013

Thanks for the report!

Fixed in a slightly different way.

Contributor

AliMd commented Jan 2, 2013

Thank you
can you more describe about your way.

@AliMd AliMd commented on the diff Jan 2, 2013

src/zepto.js
if (html.replace) html = html.replace(tagExpanderRE, "<$1></$2>")
if (name === undefined) name = fragmentRE.test(html) && RegExp.$1
if (!(name in containers)) name = '*'
var nodes, dom, container = containers[name]
- container.innerHTML = '' + html
+ container.innerHTML = html
@AliMd

AliMd Jan 2, 2013

Contributor

and more describe about this line !

Collaborator

mislav commented Jan 2, 2013

The error that you were getting is because a null argument went into append method:

el.append(null)

This was passed to fragment function, which can only deal with string values.

Instead of changing the fragment function, I've opted to fix append (and similar methods) to simply ignore null or undefined arguments, resulting in no operation being performed.

Contributor

AliMd commented Jan 5, 2013

and plz describe about that line

lopper added a commit to buddydvd/zepto that referenced this pull request Apr 24, 2013

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