Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: include.postload.js

Issue 5269160074412032: Issue 1522 - Use classList attribute instead dealing with className (Closed)
Patch Set: Created Nov. 4, 2014, 3:52 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include.postload.js
===================================================================
--- a/include.postload.js
+++ b/include.postload.js
@@ -368,7 +368,7 @@
var elt = currentElement;
var url = null;
- if (currentElement.className && currentElement.className == "__adblockplus__overlay")
+ if (currentElement.classList.contains("__adblockplus__overlay"))
{
elt = currentElement.prisoner;
url = currentElement.prisonerURL;
@@ -379,10 +379,6 @@
// Construct filters. The popup will retrieve these.
// Only one ID
var elementId = elt.id ? elt.id.split(' ').join('') : null;
- // Can have multiple classes, and there might be extraneous whitespace
- var elementClasses = null;
- if (elt.className)
- elementClasses = elt.className.replace(/\s+/g, ' ').replace(/^\s+|\s+$/g, '').split(' ');
clickHideFilters = new Array();
selectorList = new Array();
@@ -396,7 +392,7 @@
if (elementId)
addSelector("#" + elementId);
- if (elementClasses && elementClasses.length > 0)
+ if (elt.classList.length > 0)
{
var selector = "";
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld