Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

fix(jqLite): JQLiteHasClass should work even when minified #677

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/jqLite.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,7 @@ function JQLiteData(element, key, value) {
}
}

function JQLiteHasClass(element, selector, _) {
// the argument '_' is important, since it makes the function have 3 arguments, which
// is needed for delegate function to realize the this is a getter.
function JQLiteHasClass(element, selector) {
return ((" " + element.className + " ").replace(/[\n\t]/g, " ").
indexOf( " " + selector + " " ) > -1);
}
Expand Down Expand Up @@ -427,7 +425,9 @@ forEach({
JQLite.prototype[name] = function(arg1, arg2) {
var i, key;

if ((fn.length == 2 ? arg1 : arg2) === undefined) {
// JQLiteHasClass has only two arguments, but is a getter-only fn, so we need to special case it
// in a way that is minification-proof.
if (((fn.length == 2 && fn !== JQLiteHasClass) ? arg1 : arg2) === undefined) {
if (isObject(arg1)) {
// we are a write, but the object properties are the key/values
for(i=0; i < this.length; i++) {
Expand Down