Skip to content

Commit

Permalink
remove ES6 syntax from getElementsByClassName (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
rg1 committed Aug 12, 2020
1 parent 0b2808a commit 66db3e4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/dom.js
Expand Up @@ -609,10 +609,10 @@ Document.prototype = {
},

getElementsByClassName: function(className) {
const pattern = new RegExp(`(^|\\s)${className}(\\s|$)`);
return new LiveNodeList(this, base => {
var pattern = new RegExp("(^|\\s)" + className + "(\\s|$)");
return new LiveNodeList(this, function(base) {
var ls = [];
_visitNode(base.documentElement, node => {
_visitNode(base.documentElement, function(node) {
if(node !== base && node.nodeType == ELEMENT_NODE) {
if(pattern.test(node.getAttribute('class'))) {
ls.push(node);
Expand Down

0 comments on commit 66db3e4

Please sign in to comment.