{"id":185558,"date":"2013-07-04T14:48:03","date_gmt":"2013-07-04T10:48:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=185558"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=185558","title":{"rendered":"<span class=\"post_title\">\u041e\u0440\u0433\u0430\u043d\u0438\u0437\u0443\u0435\u043c \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0442\u0435\u043a\u0441\u0442\u0430 \u0432 textarea<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u0414\u043e\u0431\u0440\u044b\u0439 \u0434\u0435\u043d\u044c.<\/p>\n<p>  \u0412 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432 \u0438\u043d\u043e\u0433\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u0442\u044c\u0441\u044f \u0441 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0432\u0432\u043e\u0434\u0438\u043c\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0442\u0435\u043a\u0441\u0442\u0430 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u0439. (\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0431\u044b\u043b\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0433\u0440\u0430\u043c\u043c\u0430\u0442\u0438\u043a\u0438, \u043b\u0438\u0431\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u0434\u0435\u043b\u044f\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u0446\u0432\u0435\u0442\u043e\u043c \u0442\u0435 \u0438\u043b\u0438 \u0438\u043d\u044b\u0435 \u0441\u043b\u043e\u0432\u0430\\\u0443\u0447\u0430\u0441\u0442\u043a\u0438 \u0438 \u0442.\u0434.)<br \/>  \u041e\u0434\u043d\u0430\u043a\u043e, \u044d\u043b\u0435\u043c\u0435\u043d\u0442 textarea \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 html\\bb \u0442\u0435\u0433\u0438. \u041a\u0430\u043a \u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 contenteditable \u0432 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0445 div. <br \/>  \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0431\u043e\u043b\u0435\u0435-\u043c\u0435\u043d\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0441\u043f\u043e\u0441\u043e\u0431 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0442\u0435\u043a\u0441\u0442\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f textarea.<br \/>  <a name=\"habracut\"><\/a><\/p>\n<h4>\u041e\u0431\u0449\u0430\u044f \u0438\u0434\u0435\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f<\/h4>\n<p>  \u0422\u0430\u043a \u043a\u0430\u043a \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0442\u0435\u0433\u043e\u0432 \u0432 textarea, \u0442\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u00ab\u043c\u043d\u043e\u0433\u043e\u0441\u043b\u043e\u0439\u043d\u043e\u0441\u0442\u0438\u00bb.<br \/>  \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e z-index \u0438 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e\u0433\u043e \u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u043c \u0431\u043b\u043e\u043a pre \u0437\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u043c \u043d\u0430\u043c textarea.<br \/>  \u0412 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0435 pre \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u0448\u0440\u0438\u0444\u0442 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 textarea \u0438 \u0442\u0430\u043a\u0436\u0435 \u0437\u0430\u0434\u0430\u0434\u0438\u043c css \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u043c \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0437\u0435\u0440\u043a\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0442\u044c \u0442\u0435\u043a\u0441\u0442 \u0431\u043b\u043e\u043a\u0430 textarea (\u043e \u043d\u0438\u0445 \u0447\u0443\u0442\u044c \u043d\u0438\u0436\u0435)<br \/>  \u0422\u0430\u043a\u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e textarea \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435, \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c \u043f\u043e\u0438\u0441\u043a \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0434\u043b\u044f \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f.<br \/>  \u0418\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f:<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/110\/59e\/be2\/11059ebe21368277e2f38ffa04b50c0e.png\"\/>  <\/p>\n<h4>\u0420\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u0417\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u2014 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430 \u0432\u0445\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u043d\u043e\u0434\u044b (textarea), \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u2014 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0448\u0440\u0438\u0444\u0442\u0430 (css \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 font)<br \/>  \u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 \u0434\u043e\u043b\u0436\u0435\u043d \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 DOM-\u043c\u043e\u0434\u0435\u043b\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 pre, \u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0438 \u043f\u043e\u0432\u0435\u0441\u0438\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f. \u0421\u044e\u0434\u0430 \u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 css \u0441\u0432\u043e\u0439\u0441\u0442\u0432. <\/p>\n<pre><code>\/**   * \u0421\u043e\u0437\u0434\u0430\u0435\u0442 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 &quot;\u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e&quot; textarea   * @name TextareaExtension   * @param target - \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u043d\u043e\u0434\u0430 textarea   * @param processor - \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u043b\u043e\u0432\u0430 \u043d\u0430 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435   * @param font - \u0448\u0440\u0438\u0444\u0442    *\/ function TextareaExtension(target , processor, font) { \tvar setStyleOptions = function() \t{ \t\t\/\/\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u043b\u0430\u0441\u0441 (\u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430), \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 DOM, \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c font \t\tpreItem.className = &quot;text-area-selection&quot;; \t\ttarget.parentNode.appendChild(preItem); \t\ttarget.style.font = preItem.style.font = font || &quot;14px Ariel&quot;; \t\t \t\t\/\/\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0441\u0442\u044c, \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0441\u043a\u0440\u043e\u043b\u043b\u044b \t\ttarget.style.width = preItem.style.width = target.offsetWidth + &quot;px&quot;; \t\ttarget.style.height = preItem.style.height = target.offsetHeight + &quot;px&quot;; \t\tpreItem.style.top = target.offsetTop + &quot;px&quot;; \t\tpreItem.style.left = target.offsetLeft + &quot;px&quot;; \t\ttarget.style.background = &quot;transparent&quot;; \t\ttarget.style.overflow = &quot;scroll&quot;; \t\t \t\t\/\/\u0414\u043b\u044f \u0442\u0435\u0433\u0430 pre \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e margin \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e = 1em 0px. \u041f\u043e\u0441\u0442\u0430\u0432\u0438\u043c \u043d\u0443\u043b\u0435\u0432\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f.  \t\t\/\/(\u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 span \u0432\u043c\u0435\u0441\u0442\u043e pre \u0442\u0430\u043a\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043e\u0442\u043f\u0430\u0434\u0430\u0435\u0442) \t\tpreItem.style.margin = &quot;0px 0px&quot;; \t} \t \tsetStyleOptions(); \t \t\/\/\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043e\u0431\u044b\u0442\u0438\u044f     if (target.addEventListener) { \t\t\/\/\u041f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043d\u043e\u0432\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 textarea         target.addEventListener(&quot;change&quot;, this.analyse, false);         target.addEventListener(&quot;keyup&quot;, this.analyse, false); \t\t\/\/\u0415\u0441\u043b\u0438 \u0442\u0435\u043a\u0441\u0442\u0430 \u0431\u044b\u043b\u043e \u0432\u0432\u0435\u0434\u0435\u043d\u043e \u043c\u043d\u043e\u0433\u043e - \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043a\u0440\u043e\u043b\u044b textarea \u0438 pre         target.addEventListener(&quot;scroll&quot;, this.scrollSync, false); \t\t\/\/\u0422\u0430\u043a\u0436\u0435 \u0441\u0442\u0430\u0432\u0438\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043d\u0430 resize         target.addEventListener(&quot;mousemove&quot;, this.resize, false);     }     else         if (target.attachEvent) {             target.attachEvent(&quot;onchange&quot;, this.analyse);             target.attachEvent(&quot;onkeyup&quot;, this.analyse);             target.attachEvent(&quot;onscroll&quot;, this.scrollSync);             target.attachEvent(&quot;mousemove&quot;, this.resize);         } } <\/code><\/pre>\n<p>  \u0418\u0442\u0430\u043a, \u043a\u0430\u0440\u043a\u0430\u0441 \u043a\u043b\u0430\u0441\u0441\u0430 \u0441\u043e\u0437\u0434\u0430\u043d. \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0435\u0441\u044f \u043c\u0435\u0442\u043e\u0434\u044b \u043a\u043b\u0430\u0441\u0441\u0430:<\/p>\n<pre><code>    this.scrollSync = function () {         preItem.scrollTop = target.scrollTop;     };      this.resize = function () {         preItem.style.width = target.style.width;         preItem.style.height = target.style.height;         preItem.style.top = target.offsetTop  + &quot;px&quot;;         preItem.style.left = target.offsetLeft + &quot;px&quot;;     }; \t \t this.analyse = function (){          var text = target.value;         var words = text.split(\/[\\s]\/);         var textPosition = 0;         var result = &quot;&quot;;         \t   for (var i in words) {             if (processor(words[i])) {                 var textIndex;                 if (text.indexOf) {                     textIndex = text.indexOf(words[i]);                 }                 else textIndex = findText(text, words[i]); \t\t\t\t \t\t\t\t                 result += text.substr(0, textIndex) + &quot;&lt;span class='text-color-bordered text-checker'&gt;&quot; + words[i] + &quot;&lt;\/span&gt;&quot;; \t\t\t\t                 text = text.substr(textIndex + words[i].length, text.length);             }         }         result += text;                         preItem.innerHTML = result;     }; <\/code><\/pre>\n<p>  \u041c\u0435\u0442\u043e\u0434 analyse \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0435\u0442 \u043a\u0430\u0436\u0434\u043e\u0435 \u0441\u043b\u043e\u0432\u043e, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044f \u0435\u0433\u043e \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044e. \u0415\u0441\u043b\u0438 \u0441\u043b\u043e\u0432\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u044f\u0442\u044c\u0441\u044f \u2014 \u043c\u0435\u0442\u043e\u0434 \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0432 pre \u0438 \u00ab\u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u0442\u00bb \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0441\u043b\u043e\u0432\u043e \u0432 span \u0441 \u043a\u043b\u0430\u0441\u0441\u043e\u043c, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0449\u0438\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f (\u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u2014 \u043d\u0438\u0436\u043d\u0435\u0435 \u0442\u043e\u0447\u0435\u0447\u043d\u043e\u0435 \u043f\u043e\u0434\u0447\u0435\u0440\u043a\u0438\u0432\u0430\u043d\u0438\u0435)<br \/>  \u0414\u043b\u044f \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043e\u0432, \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0449\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u044e indexOf, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043c\u0435\u0442\u043e\u0434 \u043f\u0440\u044f\u043c\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430 \u2014 findText (\u0432 \u043d\u0435\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043f\u0440\u044f\u043c\u043e\u0439 \u043f\u0440\u043e\u0445\u043e\u0434 \u043f\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u043c)<\/p>\n<h4>CSS-\u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430<\/h4>\n<p>  \u041f\u0440\u0438\u0432\u0435\u0434\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432, \u0430 \u0437\u0430\u0442\u0435\u043c \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0438\u0445:  <\/p>\n<pre><code>.text-area-selection {     position:absolute;       padding:2px;      z-index:-1;     display:block;     word-wrap:break-word;       white-space:pre-wrap;     color:white;     overflow:scroll; }  .text-color-bordered {     border-bottom:1px dotted red; } <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0443\u0436\u0435 \u0431\u044b\u043b\u043e \u0441\u043a\u0430\u0437\u0430\u043d\u043e, \u044d\u043b\u0435\u043c\u0435\u043d\u0442 pre \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e\u0434 textarea, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u0443\u0435\u043c \u0435\u0433\u043e \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c z-index \u0432 -1. \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043e\u0442\u0441\u0442\u0443\u043f\u044b, \u0441\u043a\u0440\u043e\u043b\u043b\u044b.<br \/>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f\u043c word-wrap \u0438 white-space. \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435 \u044d\u0442\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0438\u0433\u0440\u0430\u044e\u0442 \u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u0443\u044e \u0440\u043e\u043b\u044c. <br \/>  white-space: pre-wrap \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u043f\u0440\u043e\u0431\u0435\u043b\u044b \u0432 \u0441\u0442\u0440\u043e\u043a\u0430\u0445 \u0438 \u0432 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f \u043e\u043d \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c \u0442\u0435\u043a\u0441\u0442 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u043e (\u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u0442 \u0435\u0433\u043e), \u0435\u0441\u043b\u0438 \u043e\u043d \u043d\u0435 \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u0432 1 \u0441\u0442\u0440\u043e\u043a\u0443<br \/>  word-wrap:break-word \u2014 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0442\u0435\u043a\u0441\u0442\u0430, \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u043b\u043e\u0432\u0430, \u043d\u0435 \u043f\u043e\u043c\u0435\u0449\u0430\u044e\u0449\u0438\u0435 \u043d\u0430 1 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u043d\u0435 \u0440\u0430\u0441\u0442\u044f\u0433\u0438\u0432\u0430\u044e\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u0430 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u043d\u0430 \u0434\u0440\u0443\u0433\u0443\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443.<\/p>\n<p>  \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0442\u0435\u043a\u0441\u0442\u0430 \u043f\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0443 \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0430\u0448\u0435\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438:<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/7b6\/a9b\/a56\/7b6a9ba56582c2a402e1c467028ff762.png\"\/><\/p>\n<p>  \u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438:<br \/>  <a href=\"https:\/\/github.com\/xnimorz\/textArea-selector\">\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 GitHub<\/a><br \/>  <a href=\"http:\/\/codepen.io\/xnimorz\/pen\/iLsjv\">CodePen<\/a><\/p>\n<h4>\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f<\/h4>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u0441\u043f\u043e\u0441\u043e\u0431 \u0440\u0430\u0431\u043e\u0442\u044b \u0434\u043b\u044f \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. <br \/>  \u0412 \u0442\u0435\u0445 \u0438\u043b\u0438 \u0438\u043d\u044b\u0445 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b \u0441\u043b\u0443\u0447\u0430\u0438, \u043a\u043e\u0433\u0434\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 (\u0432\u044b\u0434\u0435\u043b\u044f\u0442\u044c\\\u043d\u0435 \u0432\u044b\u0434\u0435\u043b\u044f\u0442\u044c) \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u0412 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u043e\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0430, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043f\u0438\u0441\u043e\u043a \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439. \u0410, \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 callback \u0444\u0443\u043d\u043a\u0446\u0438\u0438.    \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/185558\/\"> http:\/\/habrahabr.ru\/post\/185558\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u0414\u043e\u0431\u0440\u044b\u0439 \u0434\u0435\u043d\u044c.<\/p>\n<p>  \u0412 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432 \u0438\u043d\u043e\u0433\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u0442\u044c\u0441\u044f \u0441 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0432\u0432\u043e\u0434\u0438\u043c\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0442\u0435\u043a\u0441\u0442\u0430 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u0439. (\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0431\u044b\u043b\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0433\u0440\u0430\u043c\u043c\u0430\u0442\u0438\u043a\u0438, \u043b\u0438\u0431\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u0434\u0435\u043b\u044f\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u0446\u0432\u0435\u0442\u043e\u043c \u0442\u0435 \u0438\u043b\u0438 \u0438\u043d\u044b\u0435 \u0441\u043b\u043e\u0432\u0430\\\u0443\u0447\u0430\u0441\u0442\u043a\u0438 \u0438 \u0442.\u0434.)<br \/>  \u041e\u0434\u043d\u0430\u043a\u043e, \u044d\u043b\u0435\u043c\u0435\u043d\u0442 textarea \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 html\\bb \u0442\u0435\u0433\u0438. \u041a\u0430\u043a \u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 contenteditable \u0432 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0445 div. <br \/>  \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0431\u043e\u043b\u0435\u0435-\u043c\u0435\u043d\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0441\u043f\u043e\u0441\u043e\u0431 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0442\u0435\u043a\u0441\u0442\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f textarea.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-185558","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/185558","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=185558"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/185558\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=185558"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=185558"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=185558"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}