Javascript code too slow in Firefox extension using Storage service

前端 未结 3 1238
南笙
南笙 2021-01-26 02:45

I\'m running the following javascript code in firefox extension

highlightLinks: function(e) {

  var anchors = e.target.getElementsByTagName(\"a\");
  let file =         


        
3条回答
  •  感情败类
    2021-01-26 03:16

    first tip, altough it won't save too much time, is not using anchors.length in the condition of the for-loop. better use:

    for(var i = 0, num = anchors.length; i < num, i++) {...}
    

提交回复
热议问题