This repository has been archived by the owner on Sep 25, 2021. It is now read-only.
problems with jquery 1.9 #17
Comments
Please have a look here: There you'll find the following section:
|
This will remove all "extra" whitespace, including whitespace that should be there inside tags. |
You can adjust the function to only strip whitespace at the beginning: var originalFunc = tmpl.func;
tmpl.func = function (s, p1, p2, p3, p4, p5, offset, str) {
if (!offset && p1 && /\s/.test(p1)) {
return '';
}
return originalFunc.apply(tmpl, arguments);
}; |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
There is a smaller problem with jquery 1.9 in that the new jquery does not allow whitespace to be "first" in the html string, ie $("
test
") is allowed but $("test
") is not allowed.this makes it harder to have "pretty" templates in your code when using it with jquery.
<script id="test">for example
test
</script>will fail when used with
$(tmpl("test"))
since the template result will start with "whitespace" characrters (return, space, etc)
at the moment the workaround for me is to use the $.parseHTML function so that I now get
Is there any way to make it "trim" the whitespace at the beginning (and at the end) automaticly?
The text was updated successfully, but these errors were encountered: