]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
docs: fix various typo and import errors wording in MediaQuery
authorNicolas Coden <nicolas@ncoden.fr>
Sat, 6 Oct 2018 22:29:27 +0000 (00:29 +0200)
committerDaniel Ruf <mac1@daniel-ruf.de>
Sun, 17 Nov 2019 15:49:49 +0000 (16:49 +0100)
js/foundation.util.mediaQuery.js
test/javascript/lib/utils.js

index 42f0790a07999342badbbf5edcc49c4863f2c3df..b50176666db80480652987762e00230fa6697653 100644 (file)
@@ -157,11 +157,12 @@ var MediaQuery = {
    * Checks if the screen is within a breakpoint or smaller.
    * @function
    * @param {String} size - Name of the breakpoint to check.
+   * @returns {Boolean} `true` if the breakpoint matches, `false` if it's larger.
    */
   upTo(size) {
     const nextSize = this.next(size);
 
-    // If the next breakpoint do not match, the screen is smaller than
+    // If the next breakpoint does not match, the screen is smaller than
     // the upper limit of this breakpoint.
     if (nextSize) {
       return !this.atLeast(nextSize);
@@ -190,14 +191,14 @@ var MediaQuery = {
     if (bpModifier === 'down') {
       return this.atLeast(bpSize);
     }
-    // At leat the breakpoint  (included)
+    // At leat the breakpoint (included)
     if (!bpModifier || bpModifier === 'up') {
       return this.upTo(bpSize);
     }
 
     throw new Error(`
-      invalid breakpoint passed to MediaQuery.is().
-      Expected a breakpoint breakpoint name formatted like "<size> <modifier>", got "${size}".
+      Invalid breakpoint passed to MediaQuery.is().
+      Expected a breakpoint name formatted like "<size> <modifier>", got "${size}".
     `);
   },
 
@@ -228,8 +229,8 @@ var MediaQuery = {
     const queryIndex = this.queries.findIndex((q) => this._getQueryName(q) === size);
     if (queryIndex === -1) {
       throw new Error(`
-        unknown breakpoint "${size}" passed to MediaQuery.next().
-        Ensure it is present in your Sass settings "$breakpoints".
+        Unknown breakpoint "${size}" passed to MediaQuery.next().
+        Ensure it is present in your Sass "$breakpoints" setting.
       `);
     }
 
@@ -250,8 +251,8 @@ var MediaQuery = {
     if (typeof value === 'object')
       return value.name;
     throw new TypeError(`
-      invalid value passed to MediaQuery._getQueryName().
-      Expected a breakpoint name (String) or a query object, got "${value}"
+      Invalid value passed to MediaQuery._getQueryName().
+      Expected a breakpoint name (String) or a breakpoint query (Object), got "${value}" (${typeof value})
     `);
   },
 
index fcb5e9d2d6ddd14d89a63f43616cec01711bb73b..1b2daf148f22e141f1846c96b3e35b65ba635baf 100644 (file)
@@ -43,8 +43,8 @@
 
   /**
   * Inject a script with the attributes of the `opts` object into the
-  * given `context` HTML element. The created script is garanted to be executed
-  * in the provided context, like inside an iframe.
+  * given `context` HTML element. The created script is guaranteed to be
+  * executed in the provided context, like inside an iframe.
   *
   * @param  {HTMLElement} context - Element to add and execute the script within.
   * @param  {object} opts - Attributes to add to the created script.