On 28 August 2012 02:26, Daniel Friesen <daniel(a)nadir-seen-fire.com> wrote:
I ran into our coding conventions for creating
elements in JS:
https://www.mediawiki.org/wiki/Manual:Coding_conventions/JavaScript#Creatin…
var $hello = $('<div>').text( 'Hello' );
// Not '<div/>'
// Not '<div></div>'
This looks like some really bad advice.
The very reason I and others have been killing '<div/>' with fire is
that I was told it doesn't work in IE. Can you explain what is going
on?
Personally I don't like '<div/>' because there is no such thing in
html. I could understand '<div>' as a shortcut for creating a div
element.
Unless the issue is clarified, I think that recommending to always use
valid html like <div></div> seems a much better option than either of
<div> or <div/>.
-Niklas
--
Niklas Laxström