Created
March 29, 2017 05:35
-
-
Save moalex/e29de9b06160150310dd1391b4022bdd to your computer and use it in GitHub Desktop.
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
/* | |
* Запуск следующего кода до любого другого создаст метод trim(), если он ещё не реализуется браузером. | |
* | |
*/ | |
if (!String.prototype.trim) { | |
(function() { | |
// Вырезаем BOM и неразрывный пробел | |
String.prototype.trim = function() { | |
return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); | |
}; | |
})(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment