-
-
Notifications
You must be signed in to change notification settings - Fork 265
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
Error using .html() to copy html from one element to another #12
Comments
ghost
changed the title
$("#destination").html($("#source").html()) error
Error using .html() to copy html from one element to another
Sep 26, 2014
Great catch. I'm going to check the perf against modifying the Regex vs trim. |
Cool, I can submit a pull request with trim if you want me to. Or if you want to take it, that's cool too. |
ghost
pushed a commit
to pellucidanalytics/cash
that referenced
this issue
Sep 26, 2014
- Fix fabiospampinato#12 - Error using .html() to copy html from one element to another
ghost
mentioned this issue
Sep 26, 2014
@andypellucid I don't think I'm going to go with trim. $(' ') shouldn't create a div. I think in the HTML method I'm going to check for an object first, and then if it's not, append whatever is there to the callee. So that something like $(callee).html('.this
- is the className for this ') will actually work. |
Ok, sounds good, I'll just close my PR |
Fixed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$("#destination").html($("#source").html())
for copying content from one element to another fails in_.html/_.init
http://codepen.io/anon/pen/DhFHC
It appears that the main
_.init
function that deals with selector does not handle leading/trailing whitespace. If the innterHMTL has leading whitespace,_.init
fails to recognize it as an HTML string.One thought to address it would be to trim the selector in
_.init
in the section that checks if it's an HTML string. I can make a pull request if you think that is a reasonable route.The text was updated successfully, but these errors were encountered: