Karma/Anti-conventions: Difference between revisions
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
Not closing <img /> or <meta /> tags. | Not closing <img /> or <meta /> tags. | ||
You can usually get away with not closing these tags but they could cause weird rendering of elements that follow them. If you don't close <img>, the browser might think that any following elements are | You can usually get away with not closing these tags but they could cause weird rendering of elements that follow them. If you don't close <img>, the browser might think that any following elements are children rather than siblings and display them accordingly. | ||
<br /> | |||
<nowiki> | <nowiki> | ||
Using document.write('<div>some html</div>'); instead of $('#parentDiv').html('<div> some html </div>'); | Using document.write('<div>some html</div>'); instead of $('#parentDiv').html('<div> some html </div>'); | ||
</nowiki> | </nowiki> | ||
<br /> | |||
document.write is just bad in general. Some browsers don't like it (chromium) and in all browsers it freezes all other execution while it is writing to the page. | document.write is just bad in general. Some browsers don't like it (chromium) and in all browsers it freezes all other execution while it is writing to the page. | ||