# Code coverage report for lib/attributes/focus.js

## Statements: 80% (8 / 10) Branches: 66.67% (4 / 6) Functions: 50% (1 / 2) Lines: 75% (6 / 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

    3
    2
    2

    2

     var ScriptAttribute = require("./script");

    /**
     */

    module.exports = ScriptAttribute.extend({

      /**
       */

      update: function() {
        if (!this.currentValue) return;
        Eif (this.node.focus) {
          var self = this;

          Eif (!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);
        }
      }
    });