-
Notifications
You must be signed in to change notification settings - Fork 20.6k
$.parseHTML( "" ) should not return null #1997
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
Labels
Comments
I like the empty array idea. It would be the same behavior as parsing natively with |
wmfgerrit
pushed a commit
to wikimedia/mediawiki-extensions-VisualEditor
that referenced
this issue
Jan 7, 2015
$.parseHTML() always returns an array, except in this one case, so checking .length of the return value almost always works except when it blows up in your face. Filed upsteam as jquery/jquery#1997 Bug: T86056 Change-Id: If133a9df4d573b41b0ecb5bde47b3e6ada053921
Empty textnode would be inconsistent with browser' behaviour, so an empty array seems like a nice solution. |
jdforrester
pushed a commit
to wikimedia/mediawiki-extensions-VisualEditor
that referenced
this issue
Jan 8, 2015
$.parseHTML() always returns an array, except in this one case, so checking .length of the return value almost always works except when it blows up in your face. Filed upsteam as jquery/jquery#1997 Bug: T86056 Change-Id: If133a9df4d573b41b0ecb5bde47b3e6ada053921 (cherry picked from commit f71054d)
Closed
Closed
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
This behaviour has been there since the version version (e2497c6) but I'd like to propose changing that.
The method is documented as taking a string (of HTML) and returning an Array. Having it return null for non-string input is fair, but for empty strings it should probably return an empty array (or maybe array with empty text node).
The text was updated successfully, but these errors were encountered: