Last active
October 11, 2015 07:48
-
-
Save ethertank/3826503 to your computer and use it in GitHub Desktop.
String.obsoletedMethods
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(SP) { | |
'use strict'; | |
SP.tag = function(tagname) { | |
return '<' + tagname + '>' + this + '</' + tagname + '>'; | |
}; | |
SP.anchor || (SP.anchor = function(anchor) { | |
return '<a id="' + anchor + '" name="' + anchor + '">' + this + '</a>'; | |
}); | |
SP.bold || (SP.bold = function() { | |
return this.tag('b'); | |
}); | |
SP.italics || (SP.italics = function() { | |
return this.tag('i'); | |
}); | |
SP.link || (SP.link = function(url) { | |
return '<a href="' + url + '">' + this + '</a>'; | |
}); | |
SP.quote || (SP.quote = function() { | |
return '\"' + this + '\"'; | |
}); | |
SP.small || (SP.small = function() { | |
return this.tag('small'); | |
}); | |
SP.sub || (SP.sub = function() { | |
return this.tag('sub'); | |
}); | |
SP.sup || (SP.sup = function() { | |
return this.tag('sup'); | |
}); | |
delete SP.tag; | |
})(String.prototype); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (SP) { | |
'use strict'; | |
SP.tag = (function a(elm, attrsObj) { | |
var elm = document.createElement(elm); | |
elm.appendChild(this); | |
if (attrsObj.id) { | |
elm.setAttribute("id", attrsObj.id); | |
elm.setAttribute("name", attrsObj.id); | |
} | |
if(attrsObj.href) { | |
elm.setAttribute("href", aatrsObj.href); | |
} | |
return elm.toString(10); | |
}); | |
SP.anchor || (SP.anchor = function (anchor) { | |
return this.tag("a", { "id": anchor }); | |
}); | |
SP.bold || (SP.bold = function () { | |
return this.tag('b'); | |
}); | |
SP.italics || (SP.italics = function () { | |
return this.tag('i'); | |
}); | |
SP.link || (SP.link = function (url) { | |
return this.tag(a, { "href": url }); | |
}); | |
SP.quote || (SP.quote = function () { | |
return '\"' + this + '\"'; | |
}); | |
SP.small || (SP.small = function () { | |
return this.tag('small'); | |
}); | |
SP.sub || (SP.sub = function () { | |
return this.tag('sub'); | |
}); | |
SP.sup || (SP.sup = function () { | |
return this.tag('sup'); | |
}); | |
delete SP.tag; | |
})(String.prototype); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment