Code coverage report for lib/attributes/focus.js

Statements: 20% (2 / 10)      Branches: 0% (0 / 6)      Functions: 0% (0 / 2)      Lines: 25% (2 / 8)      Ignored: none     

All files » lib/attributes/ » focus.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 261         1                                        
var ScriptAttribute = require("./script");
 
/**
 */
 
module.exports = ScriptAttribute.extend({
 
  /**
   */
 
  update: function() {
    if (!this.currentValue) return;
    if (this.node.focus) {
      var self = this;
 
      if (!process.browser) return this.node.focus();
 
      // focus after being on screen. Need to break out
      // of animation, so setTimeout is the best option
      setTimeout(function() {
        self.node.focus();
      }, 1);
    }
  }
});