Bug 1253365 - Merge version 1.4.0 of microformats-shiv; r=mixedpuppy
authorMichael Kaply <mozilla@kaply.com>
Fri, 04 Mar 2016 11:19:18 -0600
changeset 325155 b479a3b0fde9a3dfc67dfb6dbf35d3c958fd1a9c
parent 325154 36f76c141709a89c42718b8efa9c8e272ef549c7
child 325156 269d8cec9a9b143ef4947f5cb37c915c5ee607db
push id1128
push userjlund@mozilla.com
push dateWed, 01 Jun 2016 01:31:59 +0000
treeherdermozilla-release@fe0d30de989d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmixedpuppy
bugs1253365
milestone47.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1253365 - Merge version 1.4.0 of microformats-shiv; r=mixedpuppy
toolkit/components/microformats/microformat-shiv.js
toolkit/components/microformats/test/interface-tests/get-test.js
toolkit/components/microformats/test/lib/version.js
--- a/toolkit/components/microformats/microformat-shiv.js
+++ b/toolkit/components/microformats/microformat-shiv.js
@@ -1,13 +1,13 @@
 /*
    Modern
-   microformat-shiv - v1.3.3
-   Built: 2015-12-31 01:12 - http://microformat-shiv.com
-   Copyright (c) 2015 Glenn Jones
+   microformat-shiv - v1.4.0
+   Built: 2016-03-02 10:03 - http://microformat-shiv.com
+   Copyright (c) 2016 Glenn Jones
    Licensed MIT
 */
 
 
 var Microformats; // jshint ignore:line
 
 (function (root, factory) {
     if (typeof define === 'function' && define.amd) {
@@ -17,17 +17,17 @@ var Microformats; // jshint ignore:line
     } else {
         root.Microformats = factory();
   }
 }(this, function () {
 
     var modules = {};
 
 
-    modules.version = '1.3.3';
+    modules.version = '1.4.0';
     modules.livingStandard = '2015-09-25T12:26:04Z';
 
     /**
      * constructor
      *
      */
     modules.Parser = function () {
         this.rootPrefix = 'h-';
@@ -396,33 +396,37 @@ var Microformats; // jshint ignore:line
                 'rels': {},
                 'rel-urls': {}
             };
         },
 
 
         // find microformats of a given type and return node structures
         findFilterNodes: function(rootNode, filters) {
+            if(modules.utils.isString(filters)){
+                filters = [filters];
+            }
             var newRootNode = modules.domUtils.createNode('div'),
                 items = this.findRootNodes(rootNode, true),
                 i = 0,
                 x = 0,
                 y = 0;
 
+            // add v1 names
+            y = filters.length;
+            while (y--) {
+                if(this.getMapping(filters[y])){
+                    var v1Name = this.getMapping(filters[y]).root;
+                    filters.push(v1Name);
+                }
+            }
+
             if(items){
                 i = items.length;
                 while(x < i) {
-                    // add v1 names
-                    y = filters.length;
-                    while (y--) {
-                        if(this.getMapping(filters[y])){
-                            var v1Name = this.getMapping(filters[y]).root;
-                            filters.push(v1Name);
-                        }
-                    }
                     // append matching nodes into newRootNode
                     y = filters.length;
                     while (y--) {
                         if(modules.domUtils.hasAttributeValue(items[x], 'class', filters[y])){
                             var clone = modules.domUtils.clone(items[x]);
                             modules.domUtils.appendChild(newRootNode, clone);
                             break;
                         }
--- a/toolkit/components/microformats/test/interface-tests/get-test.js
+++ b/toolkit/components/microformats/test/interface-tests/get-test.js
@@ -358,25 +358,35 @@ describe('Microformat.get', function() {
         }
 
 
         doc = document.implementation.createHTMLDocument('New Document');
         node =  document.createElement('div');
         node.innerHTML = altHTML;
         doc.body.appendChild(node);
 
+        // filter as an array
         options ={
             'node': node,
             'filters': ['h-card'],
             'dateFormat': 'html5'
         };
 
         result = Microformats.get(options);
         assert.deepEqual( result, altExpected );
 
+        // filter as an string
+        options ={
+            'node': node,
+            'filters': 'h-card',
+            'dateFormat': 'html5'
+        };
+
+        result = Microformats.get(options);
+        assert.deepEqual( result, altExpected );
    });
 
 
    it('get - filters h-event', function(){
 
        var  doc,
             node,
             options,
--- a/toolkit/components/microformats/test/lib/version.js
+++ b/toolkit/components/microformats/test/lib/version.js
@@ -1,1 +1,1 @@
-	modules.version = '1.3.3';
+	modules.version = '1.4.0';