Javascript. document.create -
is if statement saying if placeholder not in document.create(input)? why using document.create.
<input type="text" placeholder="john doe"> <input type="email"> <script> if( !'placeholder' in document.createelement('input'){ // } </script>
it's seems trying perform feature detection determine support placeholder properties on <input> elements, new html5.
the document.createelement('input') used create unmodified <input> element test. , in operator tests presence of property on dom element.
though, doesn't quite achieve seems trying. ! act before in, ends testing whether such elements have false properties, don't.
it'll need group of parenthesis ensure in evaluated first ! can negate result condition.
if (!('placeholder' in document.createelement('input'))) { // `<input>` elements don't have `placeholder` properties } note: missing closing ) if condition.
Comments
Post a Comment