pict 1.0.310 → 1.0.311

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pict",
3
- "version": "1.0.310",
3
+ "version": "1.0.311",
4
4
  "description": "Pict browser library.",
5
5
  "main": "source/Pict.js",
6
6
  "scripts": {
@@ -698,7 +698,7 @@ class PictContentAssignment extends libFableServiceBase
698
698
  * Check if an element has a class.
699
699
  *
700
700
  * @param {string|HTMLElement} pAddress - The address of the element (a CSS selector), or the element itself.
701
- * @param {string} pClass - The class to check for.
701
+ * @param {string} pClass - The class to toggle.
702
702
  *
703
703
  * @return {boolean} - Whether the element has the class. If multiple elements are matched, returns true if any have the class.
704
704
  */
@@ -733,6 +733,24 @@ class PictContentAssignment extends libFableServiceBase
733
733
  return false;
734
734
  }
735
735
  }
736
+
737
+ /**
738
+ * Toggle a class on or off an element
739
+ *
740
+ * @param {string|HTMLElement} pAddress - The address of the element (a CSS selector), or the element itself.
741
+ * @param {string} pClass - The class to check for.
742
+ */
743
+ toggleClass(pAddress, pClass)
744
+ {
745
+ if (this.hasClass(pAddress, pClass))
746
+ {
747
+ this.removeClass(pAddress, pClass);
748
+ }
749
+ else
750
+ {
751
+ this.addClass(pAddress, pClass);
752
+ }
753
+ }
736
754
  }
737
755
 
738
756
  module.exports = PictContentAssignment;
@@ -86,6 +86,16 @@ suite(
86
86
  tmpSandwich = testPict.ContentAssignment.removeClass('#MySandwich', 'pickles');
87
87
  tmpCondimentMatch = testPict.ContentAssignment.hasClass('#MySandwich', 'pickles');
88
88
  Expect(tmpCondimentMatch).to.equal(false);
89
+
90
+
91
+ tmpCondimentMatch = testPict.ContentAssignment.hasClass('#MySandwich', 'Chives');
92
+ Expect(tmpCondimentMatch).to.equal(false);
93
+ testPict.ContentAssignment.toggleClass('#MySandwich', 'Chives');
94
+ tmpCondimentMatch = testPict.ContentAssignment.hasClass('#MySandwich', 'Chives');
95
+ Expect(tmpCondimentMatch).to.equal(true);
96
+ tmpSandwich = testPict.ContentAssignment.toggleClass('#MySandwich', 'Chives');
97
+ tmpCondimentMatch = testPict.ContentAssignment.hasClass('#MySandwich', 'Chives');
98
+ Expect(tmpCondimentMatch).to.equal(false);
89
99
  fDone();
90
100
  }
91
101
  );
@@ -185,10 +185,17 @@ declare class PictContentAssignment {
185
185
  * Check if an element has a class.
186
186
  *
187
187
  * @param {string|HTMLElement} pAddress - The address of the element (a CSS selector), or the element itself.
188
- * @param {string} pClass - The class to check for.
188
+ * @param {string} pClass - The class to toggle.
189
189
  *
190
190
  * @return {boolean} - Whether the element has the class. If multiple elements are matched, returns true if any have the class.
191
191
  */
192
192
  hasClass(pAddress: string | HTMLElement, pClass: string): boolean;
193
+ /**
194
+ * Toggle a class on or off an element
195
+ *
196
+ * @param {string|HTMLElement} pAddress - The address of the element (a CSS selector), or the element itself.
197
+ * @param {string} pClass - The class to check for.
198
+ */
199
+ toggleClass(pAddress: string | HTMLElement, pClass: string): void;
193
200
  }
194
201
  //# sourceMappingURL=Pict-Content-Assignment.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Pict-Content-Assignment.d.ts","sourceRoot":"","sources":["../../source/Pict-Content-Assignment.js"],"names":[],"mappings":";AAEA;;GAEG;AACH;IAEC;;;;OAIG;IACH,oCAHW,GAAG,iBACH,MAAM,EA2GhB;IArGA,kBAAkB;IAClB,KADW,GAAG,CACN;IACR,kBAAkB;IAClB,OADW,GAAG,CACJ;IAEV,oBAA0C;IAE1C,cAAoC;IAGpC,mBAAsB;IACtB,qBAAwB;IAYxB,mBAAsB;IACtB,gBAAmB;IAMnB;;;;;;OAMG;IACH,+BAAgC;IAChC;;;;;;OAMG;IACH,gCAAiC;IACjC;;;;;;OAMG;IACH,+BAAgC;IAChC;;;;;;OAMG;IACH,4BAJU,CAAC,cAAc,EAAE,MAAM,GAAC,WAAW,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI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AM,OA2BhB;IAED;;;;;;;OAOG;IACH,mBALW,MAAM,GAAC,WAAW,UAClB,MAAM,GAEL,OAAO,CAgClB;CACD"}
1
+ {"version":3,"file":"Pict-Content-Assignment.d.ts","sourceRoot":"","sources":["../../source/Pict-Content-Assignment.js"],"names":[],"mappings":";AAEA;;GAEG;AACH;IAEC;;;;OAIG;IACH,oCAHW,GAAG,iBACH,MAAM,EA2GhB;IArGA,kBAAkB;IAClB,KADW,GAAG,CACN;IACR,kBAAkB;IAClB,OADW,GAAG,CACJ;IAEV,oBAA0C;IAE1C,cAAoC;IAGpC,mBAAsB;IACtB,qBAAwB;IAYxB,mBAAsB;IACtB,gBAAmB;IAMnB;;;;;;OAMG;IACH,+BAAgC;IAChC;;;;;;OAMG;IACH,gCAAiC;IACjC;;;;;;OAMG;IACH,+BAAgC;IAChC;;;;;;OAMG;IACH,4BAJU,CAAC,cAAc,EAAE,MAAM,GAAC,WAAW,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAIlC;IACtC;;;;;;OAMG;IACH,2BAJU,CAAC,aAAa,EAAE,MAAM,GAAC,WAAW,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAIlC;IAErC;;;;;;OAMG;IACH,6BAA8B;IAC9B;;;;;;OAMG;IACH,mCAAoC;IAGpC,iCAAuC;IAEvC,gCAAsC;IAEtC,mCAAyC;IAGzC,6BAAmC;IAEnC,4BAAkC;IAElC,+BAAqC;IAGtC;;;;;OAKG;IACH,qBAHW,MAAM,GACL,KAAK,CAAC,GAAG,CAAC,CAwCrB;IAED;;;;OAIG;IACH,wBAJW,MAAM,GAAC,WAAW,YAClB,MAAM,GAAC,OAAO,GACb,IAAI,CAkFf;IAED;;;;;OAKG;IACH,wBAHW,MAAM,GAAC,WAAW,YAClB,MAAM,OA2BhB;IAED;;;;;OAKG;IACH,oCAHW,MAAM,GAAC,WAAW,YAClB,MAAM,QAyBhB;IAED;;;;;OAKG;IACH,kCAHW,MAAM,GAAC,WAAW,Y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