3

i am planning to use data- attributes to identify elements in DOM for selenium test cases. Will the usage of attributes affects application performance?

richarbernal
  • 1,063
  • 2
  • 14
  • 32
Amareswar
  • 2,048
  • 1
  • 20
  • 36

1 Answers1

4

Not at all, you'll be fine with using data-* attributes. However, you should note that using the syntax $.data(theInput, 'someData'); is much faster than using the syntax theInput.data('someData');, as demonstrated in this jsPerf.

Elliot Bonneville
  • 51,872
  • 23
  • 96
  • 123
  • 1
    The link you posted only compares the various was to get data attributes. However, according to http://jsperf.com/class-vs-data-attribute-selector-performance it seems that get dom elements using data attributes instead of css selectors is about 98% slower! – Angel S. Moreno Sep 30 '14 at 20:45