javascript - Found this in the jquery source, how does it work? -


all 1 expression. gets put inside div in end? what's called when have bunch of comma delimited expressions?

var div = document.createelement( "div" ),     documentelement = document.documentelement,     all,     a,     select,     opt,     input,     tds,     events,     eventname,     i,     issupported; 

it declaration of bunch of variables inside function scope. first 2 variables initialized declaration. can declare/initialize multiple variables @ once separating each comma done here.

in other uses, comma character operator in javascript. mdn: the comma operator evaluates both of operands (from left right) , returns value of second operand.

the variable div initialized here empty div tag. there nothing inside yet until later code uses it. code following in jquery, puts content div , runs series of test operations on feature tests , see features supported in current browser.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -