",true);
32 |
33 | $clone.find('*[class*="small-"],*[class*="large-"]').each(function(index,element){
34 | var self = this;
35 | var class_list = $(self).attr('class').split(/\s+/);
36 | var matched_classes = class_list.filter(function(css_class){
37 | var patt = /^(small|large)-\d+$/;
38 | var res = patt.test(css_class);
39 | return res;
40 | });
41 | matched_classes.forEach(function(css_class){
42 | var split_string = css_class.split("-");
43 | $(self).attr(split_string[0],split_string[1]);
44 | $(self).removeClass(css_class);
45 | });
46 | });
47 |
48 | $clone.find('*[class=""]').removeAttr('class');
49 | return $clone.wrapAll("").parent().html();
50 | }
51 |
52 | var foo_private_method = function() {
53 | }
54 |
55 | plugin.init();
56 |
57 | }
58 |
59 | $.fn.inkyFoundation = function(options) {
60 |
61 | return this.each(function() {
62 | if (undefined == $(this).data('inkyFoundation')) {
63 | var plugin = new $.inkyFoundation(this, options);
64 | $(this).data('inkyFoundation', plugin);
65 | }
66 | });
67 |
68 | }
69 |
70 | // https://stackoverflow.com/a/20469901/2000485
71 | $.extend({
72 | replaceTag: function (currentElem, newTagObj, keepProps) {
73 | var $currentElem = $(currentElem);
74 | var i, $newTag = $(newTagObj).clone();
75 | if (keepProps) {
76 | newTag = $newTag[0];
77 | $(newTag).attr("class", $currentElem.attr("class"));
78 | var attributes = $currentElem.prop("attributes");
79 | $.each(attributes, function() {
80 | $(newTag).attr(this.name, this.value);
81 | });
82 | }
83 | $currentElem.wrapAll($newTag);
84 | // Handle empty elements - current element was within converted element when there wasn't anything to unwrap
85 | if($currentElem.contents().length > 0){
86 | $currentElem.contents().unwrap();
87 | }
88 | else{
89 | $currentElem.remove();
90 | }
91 |
92 | return this;
93 | }
94 | });
95 |
96 | $.fn.extend({
97 | replaceTag: function (newTagObj, keepProps) {
98 | return this.each(function() {
99 | jQuery.replaceTag(this, newTagObj, keepProps);
100 | });
101 | }
102 | });
103 |
104 | })(jQuery);
--------------------------------------------------------------------------------