Created
March 12, 2013 00:36
-
-
Save airportyh/5139289 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Some things to avoid and defer to jQuery when writing Javascript: | |
| document.getXYZ -> $('...') | |
| document.getElementById('abc') is okay, but some others are not. Might as well use $('#abc'). | |
| querySelector -> $('...') | |
| querySelector is not supported in IE7 - IE8, use jQuery. | |
| string.trim -> $.trim | |
| ' abc '.trim() is not supported in IE7 - IE8. Use jQuery: $.trim(' abc ') | |
| innerHTML -> text() | |
| Most of the time you are doing elm.innerHTML you really mean to do elm.innerText, but you also know that innerText doesn't work on all browsers. So just use jQuery: $('...').text() | |
| in general terms: | |
| don't use any dom api directly, if you are not sure, double check with mdn. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment