Skip to content
This repository
Browse code

Updated packages

  • Loading branch information...
commit 957a29a90f24f4226fe999cf887398ac525c8e93 1 parent 94d9020
Michael Robinson authored
1,003  packages/raptor.0deps.min.js
505 additions, 498 deletions not shown
BIN  packages/raptor.0deps.min.js.gz
Binary file not shown
1,013  packages/raptor.0deps.nc.min.js
510 additions, 503 deletions not shown
BIN  packages/raptor.0deps.nc.min.js.gz
Binary file not shown
369  packages/raptor.debug.js
... ...
@@ -1,4 +1,4 @@
1  
-/*! VERSION: 0.0.5 *//**
  1
+/*! VERSION: 0.0.6 *//**
2 2
  * @license Rangy, a cross-browser JavaScript range and selection library
3 3
  * http://code.google.com/p/rangy/
4 4
  *
@@ -25626,6 +25626,9 @@ var domTools = {
25626 25626
 
25627 25627
     getSelectedElement: function (range) {
25628 25628
         var commonAncestor;
  25629
+
  25630
+        range = range || rangy.getSelection().getRangeAt(0);
  25631
+
25629 25632
         // Check if the common ancestor container is a text node
25630 25633
         if (range.commonAncestorContainer.nodeType === 3) {
25631 25634
             // Use the parent instead
@@ -25636,6 +25639,31 @@ var domTools = {
25636 25639
         return $(commonAncestor);
25637 25640
     },
25638 25641
 
  25642
+    /**
  25643
+     * @param  {RangySelection|null} selection Selection to get html from or null to use current selection.
  25644
+     * @return {string} The html content of the selection.
  25645
+     */
  25646
+    getSelectedHtml: function(selection) {
  25647
+        selection = selection || rangy.getSelection();
  25648
+        return selection.toHtml();
  25649
+    },
  25650
+
  25651
+    getSelectionStartElement: function() {
  25652
+        var selection = rangy.getSelection();
  25653
+        if (selection.isBackwards()) {
  25654
+            return selection.focusNode.nodeType === 3 ? $(selection.focusNode.parentElement) : $(selection.focusNode);
  25655
+        }
  25656
+        return selection.anchorNode.nodeType === 3 ? $(selection.anchorNode.parentElement) : $(selection.anchorNode);
  25657
+    },
  25658
+
  25659
+    getSelectionEndElement: function() {
  25660
+        var selection = rangy.getSelection();
  25661
+        if (selection.isBackwards()) {
  25662
+            return selection.anchorNode.nodeType === 3 ? $(selection.anchorNode.parentElement) : $(selection.anchorNode);
  25663
+        }
  25664
+        return selection.focusNode.nodeType === 3 ? $(selection.focusNode.parentElement) : $(selection.focusNode);
  25665
+    },
  25666
+
25639 25667
     unwrapParentTag: function(tag) {
25640 25668
         this.getSelectedElements().each(function(){
25641 25669
             if ($(this).is(tag)) {
@@ -25938,6 +25966,66 @@ var domTools = {
25938 25966
     },
25939 25967
 
25940 25968
     /**
  25969
+     * Replace current selection with given html, ensuring that selection container is split at
  25970
+     * the start & end of the selection in cases where the selection starts / ends within an invalid element.
  25971
+     * @param  {jQuery|Element|string} html The html to replace current selection with.
  25972
+     * @param  {Array} validTagNames An array of tag names for tags that the given html may be inserted into without having the selection container split.
  25973
+     * @param  {RangySeleciton|null} selection The selection to replace, or null for the current selection.
  25974
+     */
  25975
+    replaceSelectionWithinValidTags: function(html, validTagNames, selection) {
  25976
+        selection = selection || rangy.getSelection();
  25977
+
  25978
+        var startElement = this.getSelectionStartElement()[0];
  25979
+        var endElement = this.getSelectionEndElement()[0];
  25980
+        var selectedElement = this.getSelectedElements()[0];
  25981
+
  25982
+        var selectedElementValid = this.isElementValid(selectedElement, validTagNames);
  25983
+        var startElementValid = this.isElementValid(startElement, validTagNames);
  25984
+        var endElementValid = this.isElementValid(endElement, validTagNames);
  25985
+
  25986
+        // The html may be inserted within the selected element & selection start / end.
  25987
+        if (selectedElementValid && startElementValid && endElementValid) {
  25988
+            this.replaceSelection(html);
  25989
+            return;
  25990
+        }
  25991
+
  25992
+        // Context is invalid. Split containing element and insert list in between.
  25993
+        this.replaceSelectionSplittingSelectedElement(html, selection);
  25994
+        return;
  25995
+    },
  25996
+
  25997
+    /**
  25998
+     * Split the selection container and insert the given html between the two elements created.
  25999
+     * @param  {jQuery|Element|string} html The html to replace selection with.
  26000
+     * @param  {RangySelection|null} selection The selection to replace, or null for the current selection.
  26001
+     */
  26002
+    replaceSelectionSplittingSelectedElement: function(html, selection) {
  26003
+        selection = selection || rangy.getSelection();
  26004
+
  26005
+        var selectionRange = selection.getRangeAt(0);
  26006
+        var selectedElement = this.getSelectedElements()[0];
  26007
+
  26008
+        // Select from start of selected element to start of selection
  26009
+        var startRange = rangy.createRange();
  26010
+        startRange.setStartBefore(selectedElement);
  26011
+        startRange.setEnd(selectionRange.startContainer, selectionRange.startOffset);
  26012
+        var startFragment = startRange.cloneContents();
  26013
+
  26014
+        // Select from end of selected element to end of selection
  26015
+        var endRange = rangy.createRange();
  26016
+        endRange.setStart(selectionRange.endContainer, selectionRange.endOffset);
  26017
+        endRange.setEndAfter(selectedElement);
  26018
+        var endFragment = endRange.cloneContents();
  26019
+
  26020
+        // Replace the start element's html with the content that was not selected, append html & end element's html
  26021
+        var replacement = this.outerHtml($(this.domFragmentToHtml(startFragment)));
  26022
+        replacement += this.outerHtml($(html));
  26023
+        replacement += this.outerHtml($(this.domFragmentToHtml(endFragment)));
  26024
+
  26025
+        $(selectedElement).replaceWith($(replacement));
  26026
+    },
  26027
+
  26028
+    /**
25941 26029
      * FIXME: this function needs reviewing
25942 26030
      * @public @static
25943 26031
      */
@@ -26083,11 +26171,45 @@ var domTools = {
26083 26171
     },
26084 26172
 
26085 26173
     /**
  26174
+     * Check that the given element is one of the the given tags
  26175
+     * @param  {jQuery|Element} element The element to be tested.
  26176
+     * @param  {Array}  validTagNames An array of valid tag names.
  26177
+     * @return {Boolean} True if the given element is one of the give valid tags.
  26178
+     */
  26179
+    isElementValid: function(element, validTags) {
  26180
+        return -1 !== $.inArray($(element)[0].tagName.toLowerCase(), validTags);
  26181
+    },
  26182
+
  26183
+    /**
26086 26184
      * @param  {Element|jQuery} element The element to retrieve the outer HTML from.
26087 26185
      * @return {String} The outer HTML.
26088 26186
      */
26089 26187
     outerHtml: function(element) {
26090 26188
         return $(element).clone().wrap('<div></div>').parent().html();
  26189
+    },
  26190
+
  26191
+    /**
  26192
+     * Modification of strip_tags from PHP JS - http://phpjs.org/functions/strip_tags:535.
  26193
+     * @param  {string} content HTML containing tags to be stripped
  26194
+     * @param {Array} allowedTags Array of tags that should not be stripped
  26195
+     * @return {string} HTML with all tags not present allowedTags array.
  26196
+     */
  26197
+    stripTags: function(content, allowedTags) {
  26198
+        // making sure the allowed arg is a string containing only tags in lowercase (<a><b><c>)
  26199
+        allowed = [];
  26200
+        for (var allowedTagsIndex = 0; allowedTagsIndex < allowedTags.length; allowedTagsIndex++) {
  26201
+            if (allowedTags[allowedTagsIndex].match(/[a-z][a-z0-9]+/g)) {
  26202
+                allowed.push('<' + allowedTags[allowedTagsIndex] + '>');
  26203
+            }
  26204
+        }
  26205
+
  26206
+        // making sure the allowed arg is a string containing only tags in lowercase (<a><b><c>)
  26207
+        var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>/gi,
  26208
+            commentsAndPhpTags = /<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi;
  26209
+
  26210
+        return content.replace(commentsAndPhpTags, '').replace(tags, function ($0, $1) {
  26211
+            return allowed.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : '';
  26212
+        });
26091 26213
     }
26092 26214
 };/**
26093 26215
  * Editor internationalization (i18n) private functions and properties.
@@ -26414,7 +26536,6 @@ $.widget('ui.editor',
26414 26536
         this.ui = {};
26415 26537
         this.plugins = {};
26416 26538
         this.templates = $.extend({}, $.ui.editor.templates);
26417  
-//        this.changeTimer = null;
26418 26539
 
26419 26540
         // jQuery DOM elements
26420 26541
         this.wrapper = null;
@@ -26660,13 +26781,6 @@ $.widget('ui.editor',
26660 26781
 
26661 26782
     change: function() {
26662 26783
         this.fire('change');
26663  
-//        if (this.changeTimer !== null) {
26664  
-//            return;
26665  
-//        }
26666  
-//        this.changeTimer = window.setTimeout(function(editor) {
26667  
-//            editor.fire('change');
26668  
-//            editor.changeTimer = null;
26669  
-//        }, 1000, this);
26670 26784
     },
26671 26785
 
26672 26786
     /*========================================================================*\
@@ -26751,7 +26865,6 @@ $.widget('ui.editor',
26751 26865
             }
26752 26866
             this.fire('enabled');
26753 26867
             this.fire('resize');
26754  
-//            this.change();
26755 26868
         }
26756 26869
     },
26757 26870
 
@@ -29793,7 +29906,9 @@ $.ui.editor.registerPlugin('hotkeys', /** @lends $.editor.plugin.hotkeys.prototy
29793 29906
             this.indexedActions[this.isNumeric(action.key) ? action.key : action.key.charCodeAt(0)] = action;
29794 29907
             if (typeof action.ui !== 'undefined') {
29795 29908
                 var uiObject = this.editor.getUi(action.ui);
29796  
-                uiObject.ui.button.attr('title', uiObject.ui.title + ' (' + action.label + ')');
  29909
+                if (typeof uiObject !== 'undefined') {
  29910
+                    uiObject.ui.button.attr('title', uiObject.ui.title + ' (' + action.label + ')');
  29911
+                }
29797 29912
             }
29798 29913
         }
29799 29914
 
@@ -31465,10 +31580,189 @@ $.ui.editor.registerUi({
31465 31580
     }
31466 31581
 });
31467 31582
 /**
31468  
- * @fileOverview UI Components for inserting ordered and unordered lists
  31583
+ * @fileOverview UI components & plugin for inserting ordered and unordered lists
31469 31584
  * @author David Neilsen david@panmedia.co.nz
31470 31585
  * @author Michael Robinson michael@panmedia.co.nz
31471 31586
  */
  31587
+$.ui.editor.registerPlugin('list', /** @lends $.editor.plugin.list.prototype */ {
  31588
+
  31589
+    /**
  31590
+     * @name $.editor.plugin.list.options
  31591
+     * @type {Object}
  31592
+     * @namespace Default options
  31593
+     * @see $.editor.plugin.list
  31594
+     */
  31595
+    options: /** @lends $.editor.plugin.list.options */  { },
  31596
+
  31597
+    /**
  31598
+     * Tag names for elements that are allowed to contain ul/ol elements.
  31599
+     * @type {Array}
  31600
+     */
  31601
+    validParents: [
  31602
+        'blockquote', 'body', 'button', 'center', 'dd', 'div', 'fieldset', 'form', 'iframe', 'li',
  31603
+        'noframes', 'noscript', 'object', 'td', 'th'
  31604
+    ],
  31605
+
  31606
+    /**
  31607
+     * Tag names for elements that may be contained by li elements.
  31608
+     * @type {Array}
  31609
+     */
  31610
+    validChildren: [
  31611
+        'a', 'abbr','acronym', 'applet', 'b', 'basefont', 'bdo', 'big', 'br', 'button', 'cite', 'code', 'dfn',
  31612
+        'em', 'font', 'i', 'iframe', 'img', 'input', 'kbd', 'label', 'map', 'object', 'p', 'q', 's',  'samp',
  31613
+        'select', 'small', 'span', 'strike', 'strong', 'sub', 'sup', 'textarea', 'tt', 'u', 'var'
  31614
+    ],
  31615
+
  31616
+    /**
  31617
+     * Toggle listType depending on the current selection.
  31618
+     * This function fires both the selectionChange & change events when the action is complete.
  31619
+     * @param  {string} listType One of ul or ol.
  31620
+     */
  31621
+    toggleList: function(listType) {
  31622
+
  31623
+        // Check whether selection is fully contained by a ul/ol. If so, unwrap parent ul/ol
  31624
+        if ($(this.editor.getSelectedElements()).is('li')
  31625
+            && $(this.editor.getSelectedElements()).parent().is(listType)) {
  31626
+            this.unwrapList();
  31627
+        } else {
  31628
+            this.wrapList(listType);
  31629
+        }
  31630
+
  31631
+        this.editor.fire('selectionChange');
  31632
+        this.editor.fire('change');
  31633
+    },
  31634
+
  31635
+    /**
  31636
+     * Extract the contents of all selected li elements.
  31637
+     * If the list element's parent is not a li, then wrap the content of each li in a p, else leave them unwrapped.
  31638
+     */
  31639
+    unwrapList: function() {
  31640
+        this.editor.saveSelection();
  31641
+
  31642
+        // Array containing the html contents of each of the selected li elements.
  31643
+        var listElementsContent = [];
  31644
+        // Array containing the selected li elements themselves.
  31645
+        var listElements = [];
  31646
+
  31647
+        // The element within which selection begins.
  31648
+        var startElement = this.editor.getSelectionStartElement();
  31649
+        // The element within which ends.
  31650
+        var endElement = this.editor.getSelectionEndElement();
  31651
+
  31652
+        // Collect the first selected list element's content
  31653
+        listElementsContent.push($(startElement).html());
  31654
+        listElements.push(startElement);
  31655
+
  31656
+        // Collect the remaining list elements' content
  31657
+        if ($(startElement)[0] !== $(endElement)[0]) {
  31658
+            var currentElement = startElement;
  31659
+            do  {
  31660
+                currentElement = $(currentElement).next();
  31661
+                listElementsContent.push($(currentElement).html());
  31662
+                listElements.push(currentElement);
  31663
+            } while($(currentElement)[0] !== $(endElement)[0]);
  31664
+        }
  31665
+
  31666
+        // Boolean values used to determine whether first / last list element of the parent is selected.
  31667
+        var firstLiSelected = $(startElement).prev().length === 0;
  31668
+        var lastLiSelected = $(endElement).next().length === 0;
  31669
+
  31670
+        // The parent list container, e.g. the parent ul / ol
  31671
+        var parentListContainer = $(startElement).parent();
  31672
+
  31673
+        // Remove the list elements from the DOM.
  31674
+        for (listElementsIndex = 0; listElementsIndex < listElements.length; listElementsIndex++) {
  31675
+            $(listElements[listElementsIndex]).remove();
  31676
+        }
  31677
+
  31678
+        // Wrap list element content in p tags if the list element parent's parent is not a li.
  31679
+        for (var listElementsContentIndex = 0; listElementsContentIndex < listElementsContent.length; listElementsContentIndex++) {
  31680
+            if (!parentListContainer.parent().is('li')) {
  31681
+                listElementsContent[listElementsContentIndex] = '<p>' + listElementsContent[listElementsContentIndex] + '</p>';
  31682
+            }
  31683
+        }
  31684
+
  31685
+        // Every li of the list has been selected, replace the entire list
  31686
+        if (firstLiSelected && lastLiSelected) {
  31687
+            this.editor.selectOuter(parentListContainer);
  31688
+            this.editor.replaceSelection(listElementsContent.join(''));
  31689
+            return;
  31690
+        }
  31691
+
  31692
+        if (firstLiSelected) {
  31693
+            $(parentListContainer).before(listElementsContent.join(''));
  31694
+        } else if (lastLiSelected) {
  31695
+            $(parentListContainer).after(listElementsContent.join(''));
  31696
+        } else {
  31697
+            this.editor.replaceSelectionSplittingSelectedElement(listElementsContent.join(''));
  31698
+        }
  31699
+
  31700
+        this.editor.restoreSelection();
  31701
+    },
  31702
+
  31703
+    /**
  31704
+     * Wrap the selection with the given listType.
  31705
+     * @param  {string} listType One of ul or ol.
  31706
+     */
  31707
+    wrapList: function(listType) {
  31708
+
  31709
+        var selectedHtml = $('<div>').html(this.editor.getSelectedHtml());
  31710
+
  31711
+        var listElements = [];
  31712
+        var plugin = this;
  31713
+
  31714
+        // Convert child block elements to list elements
  31715
+        $(selectedHtml).contents().each(function() {
  31716
+            var liContent;
  31717
+            // Use only content of block elements
  31718
+            if ('block' === plugin.getElementDefaultDisplay(this.tagName)) {
  31719
+                liContent = plugin.editor.stripTags($(this).html(), plugin.validChildren);
  31720
+            } else {
  31721
+                liContent = plugin.editor.stripTags(plugin.editor.outerHtml($(this)), plugin.validChildren);
  31722
+            }
  31723
+
  31724
+            // Avoid inserting blank lists
  31725
+            var listElement = $('<li>' + liContent + '</li>');
  31726
+            if ($.trim(listElement.text()) !== '') {
  31727
+                listElements.push(plugin.editor.outerHtml(listElement));
  31728
+            }
  31729
+        });
  31730
+
  31731
+        // When selection is empty, insert a placeholder list
  31732
+        if (!listElements.length) {
  31733
+            listElements.push('<li>List element content</li>');
  31734
+        }
  31735
+
  31736
+        var replacementClass = this.options.baseClass + '-selection';
  31737
+        var replacementHtml = '<' + listType + ' class="' + replacementClass + '">' + listElements.join('') + '</' + listType + '>';
  31738
+
  31739
+        // Selection must be restored before it may be replaced.
  31740
+        this.editor.restoreSelection();
  31741
+        this.editor.replaceSelectionWithinValidTags(replacementHtml, this.validParents);
  31742
+
  31743
+        // Select the first list element of the inserted list
  31744
+        var selectedElement = $(this.editor.getElement().find('.' + replacementClass).removeClass(replacementClass));
  31745
+        this.editor.selectInner(selectedElement.find('li:first')[0]);
  31746
+    },
  31747
+
  31748
+    /**
  31749
+     * Determine whether element is inline or block.
  31750
+     * @see http://stackoverflow.com/a/2881008/187954
  31751
+     * @param  {string} tag Lower case tag name, e.g. 'a'.
  31752
+     * @return {string} Default display style for tag.
  31753
+     */
  31754
+    getElementDefaultDisplay: function(tag) {
  31755
+        var cStyle,
  31756
+            t = document.createElement(tag),
  31757
+            gcs = "getComputedStyle" in window;
  31758
+
  31759
+        document.body.appendChild(t);
  31760
+        cStyle = (gcs ? window.getComputedStyle(t, "") : t.currentStyle).display;
  31761
+        document.body.removeChild(t);
  31762
+
  31763
+        return cStyle;
  31764
+    }
  31765
+});
31472 31766
 
31473 31767
 $.ui.editor.registerUi({
31474 31768
 
@@ -31479,6 +31773,7 @@ $.ui.editor.registerUi({
31479 31773
      */
31480 31774
     listUnordered: /** @lends $.editor.ui.listUnordered.prototype */ {
31481 31775
 
  31776
+
31482 31777
         /**
31483 31778
          * @see $.ui.editor.defaultUi#init
31484 31779
          */
@@ -31486,12 +31781,7 @@ $.ui.editor.registerUi({
31486 31781
             return editor.uiButton({
31487 31782
                 title: _('Unordered List'),
31488 31783
                 click: function() {
31489  
-                    if (!editor.selectionExists(rangy.getSelection())) {
31490  
-                        editor.insertElement('<ul><li>First list item</li></ul>');
31491  
-                    } else {
31492  
-                        editor.toggleWrapper('ul');
31493  
-                        editor.toggleWrapper('li');
31494  
-                    }
  31784
+                    editor.getPlugin('list').toggleList('ul');
31495 31785
                 }
31496 31786
             });
31497 31787
         }
@@ -31511,12 +31801,7 @@ $.ui.editor.registerUi({
31511 31801
             return editor.uiButton({
31512 31802
                 title: _('Ordered List'),
31513 31803
                 click: function() {
31514  
-                    if (!editor.selectionExists(rangy.getSelection())) {
31515  
-                        editor.insertElement('<ol><li>First list item</li></ol>');
31516  
-                    } else {
31517  
-                        editor.toggleWrapper('ol');
31518  
-                        editor.toggleWrapper('li');
31519  
-                    }
  31804
+                    editor.getPlugin('list').toggleList('ol');
31520 31805
                 }
31521 31806
             });
31522 31807
         }
@@ -31587,7 +31872,7 @@ $.ui.editor.registerUi({
31587 31872
                     }
31588 31873
 
31589 31874
                     this.ui.button.find('.ui-button-icon-primary').css({
31590  
-                        'background-image': 'url(http://www.jquery-raptor.com/logo/0.0.5?' + query.join('&') + ')'
  31875
+                        'background-image': 'url(http://www.jquery-raptor.com/logo/0.0.6?' + query.join('&') + ')'
31591 31876
                     });
31592 31877
                 }
31593 31878
             });
@@ -31617,20 +31902,7 @@ $.ui.editor.registerPlugin('paste', /** @lends $.editor.plugin.paste.prototype *
31617 31902
          * @type {Array}
31618 31903
          */
31619 31904
         allowedTags: [
31620  
-            '<h1>',
31621  
-            '<h2>',
31622  
-            '<h3>',
31623  
-            '<h4>',
31624  
-            '<h5>',
31625  
-            '<h6>',
31626  
-            '<div>',
31627  
-            '<ul>',
31628  
-            '<ol>',
31629  
-            '<li>',
31630  
-            '<blockquote>',
31631  
-            '<p>',
31632  
-            '<a>',
31633  
-            '<span>'
  31905
+            'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'div', 'ul', 'ol', 'li', 'blockquote', 'p', 'a', 'span'
31634 31906
         ]
31635 31907
     },
31636 31908
 
@@ -31659,7 +31931,7 @@ $.ui.editor.registerPlugin('paste', /** @lends $.editor.plugin.paste.prototype *
31659 31931
                 var content = $(selector).html();
31660 31932
                 content = plugin.filterAttributes(content);
31661 31933
                 content = plugin.filterChars(content);
31662  
-                content = plugin.stripTags(content);
  31934
+                content = plugin.editor.stripTags(content, plugin.options.allowedTags);
31663 31935
                 content = plugin.stripEmpty(content);
31664 31936
                 var vars = {
31665 31937
                     html: content,
@@ -31673,7 +31945,6 @@ $.ui.editor.registerPlugin('paste', /** @lends $.editor.plugin.paste.prototype *
31673 31945
                     plugin.updateAreas(this, dialog);
31674 31946
                 });
31675 31947
 
31676  
-
31677 31948
                 $(dialog).dialog({
31678 31949
                     modal: true,
31679 31950
                     width: 650,
@@ -31711,7 +31982,7 @@ $.ui.editor.registerPlugin('paste', /** @lends $.editor.plugin.paste.prototype *
31711 31982
                             {
31712 31983
                                 text: _('Cancel'),
31713 31984
                                 click: function() {
31714  
-                                    rangy.restoreSelection(selection);
  31985
+                                    editor.restoreSelection();
31715 31986
                                     inProgress = false;
31716 31987
                                     $(this).dialog('close');
31717 31988
                                 }
@@ -31848,20 +32119,6 @@ $.ui.editor.registerPlugin('paste', /** @lends $.editor.plugin.paste.prototype *
31848 32119
     },
31849 32120
 
31850 32121
     /**
31851  
-     * Clone of strip_tags from PHP JS - http://phpjs.org/functions/strip_tags:535.
31852  
-     * @param  {String} content HTML containing tags to be stripped
31853  
-     * @return {String} HTML with all tags not present in the $.editor.plugin.paste.options.allowedTags array
31854  
-     */
31855  
-    stripTags: function(content) {
31856  
-        allowed = (((this.options.allowedTags || "") + "").toLowerCase().match(/<[a-z][a-z0-9]*>/g) || []).join(''); // making sure the allowed arg is a string containing only tags in lowercase (<a><b><c>)
31857  
-        var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>/gi,
31858  
-            commentsAndPhpTags = /<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi;
31859  
-        return content.replace(commentsAndPhpTags, '').replace(tags, function ($0, $1) {
31860  
-            return allowed.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : '';
31861  
-        });
31862  
-    },
31863  
-
31864  
-    /**
31865 32122
      * Remove empty tags.
31866 32123
      * @param  {String} content The HTML containing empty elements to be removed
31867 32124
      * @return {String} The cleaned HTML
BIN  packages/raptor.debug.js.gz
Binary file not shown
291  packages/raptor.light.min.js
149 additions, 142 deletions not shown
BIN  packages/raptor.light.min.js.gz
Binary file not shown
318  packages/raptor.min.js
243 additions, 75 deletions not shown
BIN  packages/raptor.min.js.gz
Binary file not shown

0 notes on commit 957a29a

Please sign in to comment.
Something went wrong with that request. Please try again.