{"id":249373,"date":"2015-02-03T20:02:03","date_gmt":"2015-02-03T16:02:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=249373"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=249373","title":{"rendered":"<span class=\"post_title\">\u041a\u0430\u043a \u0440\u0430\u0441\u043f\u0443\u0442\u044b\u0432\u0430\u0442\u044c \u043b\u0430\u043f\u0448\u0443, \u043d\u0435 \u0432\u043f\u0430\u0434\u0430\u044f \u0432 \u0434\u0435\u043f\u0440\u0435\u0441\u0441\u0438\u044e<\/span>"},"content":{"rendered":"<div class=\"content html_format\">     \t\u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0435 \u043f\u0440\u043e \u0432\u0430\u0448\u0438 \u0441\u043b\u0430\u0434\u043a\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b \u043d\u0430 \u0440\u0435\u0430\u043a\u0442\u0435, \u0430\u043d\u0433\u0443\u043b\u044f\u0440\u0435 \u0438\u043b\u0438 \u0447\u0442\u043e \u0432\u044b \u0442\u0430\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435? \u042d\u0442\u043e \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u0440\u043e \u0442\u0435 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438, \u043a\u043e\u0433\u0434\u0430 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043a\u0443\u0447\u043a\u0430 jQuery \u043b\u0430\u043f\u0448\u0438. \u041d\u0435\u0442, \u043f\u0443\u0441\u0442\u044c \u044d\u0442\u043e \u0431\u0443\u0434\u0443\u0442 \u0433\u043e\u0440\u044b jQuery \u043b\u0430\u043f\u0448\u0438, \u0437\u0430\u0432\u0435\u0440\u043d\u0443\u0442\u043e\u0439 \u0432\u043e \u0432\u044c\u044e\u0448\u043a\u0438 \u0431\u044d\u043a\u0431\u043e\u043d\u0430.<\/p>\n<p>  <sup>\u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <a href=\"https:\/\/github.com\/backbonex\/backbone.view.elements\">\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 Backbone.View.Elements<\/a><\/sup><\/p>\n<h2>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043f\u0435\u0440\u0432\u0430\u044f: \u043c\u0430\u043b\u043e\u0432\u044b\u0440\u0430\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u044b<\/h2>\n<p>  \u0412\u0441\u0435 \u043c\u044b \u0432\u0438\u0434\u0435\u043b\u0438 \u043b\u0430\u043f\u0448\u0443, \u0432\u0441\u0435 \u043c\u044b \u0437\u043d\u0430\u0435\u043c: \u043b\u0430\u043f\u0448\u0430 \u0432 JS\u0435 \u2014 \u043d\u0430\u0432\u0435\u0440\u043d\u043e \u0438 \u0432 \u0432\u0435\u0440\u0441\u0442\u043a\u0435 \u043d\u0435 \u0432\u0441\u0435 \u0445\u043e\u0440\u043e\u0448\u043e. \u0410 \u0440\u0430\u0437 \u0432\u0441\u0435 \u0442\u0430\u043a, \u0442\u043e \u043a\u043e\u0434, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u043a\u0438\u0448\u0438\u0442 \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u044b\u043c\u0438 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u044f\u043c\u0438 \u0441 \u0434\u043e\u043c\u043e\u043c. \u0427\u0438\u0442\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434 \u0441\u043b\u043e\u0436\u043d\u043e, \u0432\u0435\u0434\u044c \u043d\u0430\u0434\u043e, \u043d\u0435 \u0443\u043f\u0443\u0441\u043a\u0430\u044f \u043c\u044b\u0441\u043b\u0438 \u0430\u0432\u0442\u043e\u0440\u0430 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u0432\u043e\u043e\u0431\u0449\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442, \u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0432 \u0443\u043c\u0435 \u043a\u0443\u0447\u043a\u0443 \u043d\u0435\u0432\u043d\u044f\u0442\u043d\u044b\u0445 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0439 \u0434\u043b\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432. \u0418\u0442\u0430\u043a, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u0438\u0434\u0430\u0434\u0438\u043c \u043a\u043e\u0434\u0443 \u043d\u0435\u043c\u043d\u043e\u0436\u043a\u043e \u0432\u044b\u0440\u0430\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438:  <\/p>\n<pre><code class=\"javascript\">_selectors: function () {     return {         elemName: '.block__elem-name'     }; } <\/code><\/pre>\n<p>\u0421\u043b\u043e\u0436\u0438\u043c \u0432\u0441\u0435 \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u044b \u0432 \u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u0438 \u0434\u0430\u0434\u0438\u043c \u043f\u043e\u043d\u044f\u0442\u043d\u043e\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c, \u0434\u043b\u044f \u0432\u044b\u0431\u043e\u0440\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u043d\u0438 \u043d\u0443\u0436\u043d\u044b. \u0412\u044b\u0431\u0438\u0440\u0430\u0442\u044c \u043c\u044b \u0438\u0445, \u043a\u0441\u0442\u0430\u0442\u0438, \u0431\u0443\u0434\u0435\u043c \u0432\u043e\u0442 \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"javascript\">this._elem('elemName'); <\/code><\/pre>\n<p>\u0432\u043c\u0441\u0435\u0442\u043e  <\/p>\n<pre><code class=\"javascript\">this.$('.block__elem-name'); <\/code><\/pre>\n<p>  <a name=\"habracut\"><\/a><br \/>  \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u043c\u0430\u043b\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u043e \u0432\u044b\u0440\u0430\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043d\u043e \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0439\u0442\u0435, \u0447\u0442\u043e \u0443 \u0432\u0430\u0441, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u043d\u0435 \u043f\u0440\u043e\u0435\u043a\u0442, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439 \u0411\u042d\u041c \u0434\u043b\u044f \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u0430 \u0441\u043b\u0430\u0434\u043a\u043e \u043f\u0430\u0445\u043d\u0443\u0449\u0438\u0435 \u0441\u0432\u0435\u0440\u0445 \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u0447\u043d\u044b\u0435 \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u044b \u0432\u0438\u0434\u0430   <\/p>\n<pre><code class=\"javascript\">\u2018div &gt; tr.row[data-active=\u201dtrue\u201d] a.red-Button\u2019 <\/code><\/pre>\n<p>\u0434\u043b\u044f \u043a\u043d\u043e\u043f\u043e\u043a \u201c\u043a\u0443\u043f\u0438\u0442\u044c\u201d.<\/p>\n<p>  \u041f\u043e\u043c\u0438\u043c\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0430\u0448\u0435\u0439 \u0432\u044c\u044e\u0448\u043a\u0438, \u043c\u044b \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0430\u043c \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440 \u043f\u043e \u0438\u043c\u0435\u043d\u0438:  <\/p>\n<pre><code class=\"javascript\">this._selector('elemName'); <\/code><\/pre>\n<p>\u042d\u0442\u043e \u0442\u043e\u0436\u0435 \u0431\u044b\u0432\u0430\u0435\u0442 \u043d\u0443\u0436\u043d\u043e.<\/p>\n<p>  \u0415\u0449\u0435 \u043e\u0434\u043d\u043e \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e \u2014 \u0435\u0441\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u0441\u044f \u0432\u0435\u0440\u0441\u0442\u043a\u0430, \u0442\u043e \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u044b \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u043b\u0438 \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u0434\u0430.<\/p>\n<h2>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432\u0442\u043e\u0440\u0430\u044f: \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432<\/h2>\n<p>  \u0417\u043d\u0430\u0435\u0442\u0435, \u0431\u044b\u0432\u0430\u0435\u0442 \u0432\u043e\u0442 \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"javascript\">$(\u2018div &gt; tr.row[data-active=\u201dtrue\u201d] a.red-Button\u2019).blahBlah(); <\/code><\/pre>\n<p>\u0430 \u0447\u0435\u0440\u0435\u0437 10 \u0441\u0442\u0440\u043e\u043a \u0432\u043e\u0442 \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"javascript\">$(\u2018div &gt; tr.row[data-active=\u201dtrue\u201d] a.red-Button\u2019).anotherBlahBlah(); <\/code><\/pre>\n<p>  \u041e\u0442\u043e\u0434\u0440\u0430\u0432 \u043b\u0430\u0434\u043e\u043d\u044c \u043e\u0442 \u043b\u0438\u0446\u0430, \u0432\u044b \u0432\u044b\u043d\u0435\u0441\u0435\u0442\u0435 \u044d\u0442\u043e \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e  <\/p>\n<pre><code class=\"javascript\">var $buyButton = $(\u2018div &gt; tr.row[data-active=\u201dtrue\u201d] a.red-Button\u2019); <\/code><\/pre>\n<p>\u043e\u0439 \u043d\u0435\u0442, \u0443 \u0432\u0430\u0441 \u0436\u0435 Backbone \u2014 \u0432\u044b\u043d\u0435\u0441\u0435\u0442\u0435 \u0432 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e  <\/p>\n<pre><code class=\"javascript\">this._$buyButton = this.$(\u2018div &gt; tr.row[data-active=\u201dtrue\u201d] a.red-Button\u2019); <\/code><\/pre>\n<p>\u0438\u043b\u0438 \u0432\u044b \u0443\u0436\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043b\u0438 Backbone.View.Elements?  <\/p>\n<pre><code class=\"javascript\">this._$buyButton = this._elem(\u2018buyButton\u2019); <\/code><\/pre>\n<p>  \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u2014 <code>_elem<\/code> \u0438 \u0442\u0430\u043a \u0432\u0441\u0435 \u043a\u0435\u0448\u0438\u0440\u0443\u0435\u0442, \u0442\u0430\u043a \u0447\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e  <\/p>\n<pre><code class=\"javascript\">this._elem(\u2018buyButton\u2019); <\/code><\/pre>\n<p>  <\/p>\n<h3>\u041a\u0435\u0448\u0438\u0440\u0443\u0435\u0442, \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0435? \u0410 \u0447\u0442\u043e, \u0435\u0441\u043b\u0438 \u0432\u0441\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u0441\u044f?<\/h3>\n<p>  \u0414\u0430, \u043c\u044b \u0442\u043e\u0436\u0435 \u0441\u043b\u044b\u0448\u0430\u043b\u0438, \u0447\u0442\u043e \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0434\u0432\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b. \u041f\u043e\u044d\u0442\u043e\u043c\u0443  <\/p>\n<pre><code class=\"javascript\">this._findElem('elemName'); <\/code><\/pre>\n<p>\u0438\u0449\u0435\u0442 \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u0435\u0448\u0430  <\/p>\n<pre><code class=\"javascript\">this._dropElemCache(\u2018elemName\u2019); <\/code><\/pre>\n<p>\u043f\u043e\u0447\u0438\u0441\u0442\u0438\u0442 \u043a\u0435\u0448 \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430, \u0430  <\/p>\n<pre><code class=\"javascript\">this._dropElemCache(); <\/code><\/pre>\n<p>\u043e\u0442\u0447\u0438\u0441\u0442\u0438\u0442 \u0432\u0435\u0441\u044c \u0432\u0430\u0448 \u043a\u0435\u0448 \u0434\u043e \u0431\u043b\u0435\u0441\u043a\u0430, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u043f\u043e\u0439\u043c\u0435\u0442\u0435, \u0447\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u0440\u0438\u0448\u043b\u043e. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u0441\u043b\u0435 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430.<\/p>\n<h3>\u0413\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b<\/h3>\n<p>  \u0410 \u0435\u0449\u0435 \u043c\u044b \u0437\u0430\u0432\u0435\u0440\u043d\u0443\u043b\u0438 \u0432 jQuery \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0430 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438. \u0412\u0441\u0442\u0440\u0435\u0447\u0430\u0439\u0442\u0435:  <\/p>\n<pre><code class=\"javascript\">this._$window; this._$body; this._$document; <\/code><\/pre>\n<h2>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0442\u0440\u0435\u0442\u044c\u044f: \u0438\u043c\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0435 \u0441\u0442\u0438\u043b\u0438<\/h2>\n<p>  \u0412\u0440\u043e\u0434\u0435 \u0431\u044b \u0446\u0435\u043b\u044b\u0439 \u044f\u0437\u044b\u043a \u0435\u0441\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u0441\u0442\u0438\u043b\u0438 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c, \u043d\u043e \u043d\u0435\u0442 \u2014 \u0442\u043e \u0438 \u0434\u0435\u043b\u043e \u0432 \u043b\u0430\u043f\u0448\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043a\u0440\u0430\u0441\u0438\u0442\u0435\u043b\u0438:  <\/p>\n<pre><code class=\"javascript\">$(\u2018div &gt; tr.row[data-active=\u201dtrue\u201d] a.red-Button\u2019).css({color: \u2018magenta\u2019}); <\/code><\/pre>\n<p>\u0421\u043a\u043e\u0440\u0435\u0435 \u043f\u043e\u043f\u0435\u0440\u0447\u0438\u0442\u0435 \u0432\u0441\u0435 \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c\u044e \u0438 \u0445\u043e\u0440\u043e\u0448\u0435\u043d\u044c\u043a\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0430\u0439\u0442\u0435 CSS:  <\/p>\n<pre><code class=\"css\">.button_active {   color: magenta; } <\/code><\/pre>\n<p>\u0410 \u0443\u0436 \u043e\u0431 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438 \u043c\u044b \u043f\u043e\u0437\u0430\u0431\u043e\u0442\u0438\u043b\u0438\u0441\u044c. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u043c \u0432\u0441\u0435 \u043a\u043b\u0430\u0441\u0441\u044b \u0432 \u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435:  <\/p>\n<pre><code class=\"javascript\">_classes: function () {     return {         activeButton: 'button_active'     }; } <\/code><\/pre>\n<p>\u0410 \u043f\u043e\u0442\u043e\u043c, \u0445\u043e\u0442\u0438\u0442\u0435 \u2014 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0439\u0442\u0435 \u043a\u043b\u0430\u0441\u0441  <\/p>\n<pre><code class=\"javascript\">this._addClass(\u2018activeButton\u2019, \u2018buyButton\u2019); <\/code><\/pre>\n<p>\u0445\u043e\u0442\u0438\u0442\u0435 \u2014 \u0443\u0434\u0430\u043b\u044f\u0439\u0442\u0435:  <\/p>\n<pre><code class=\"javascript\">this._removeClass(\u2018activeButton\u2019, \u2018buyButton\u2019); <\/code><\/pre>\n<p>\u0445\u043e\u0442\u0438\u0442\u0435 \u2014 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0439\u0442\u0435:  <\/p>\n<pre><code class=\"javascript\">var condition = !!Math.round(Math.random()); this._toggleClass(\u2018activeButton\u2019, \u2018buyButton\u2019, condition); <\/code><\/pre>\n<p>  \u041c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440, \u0435\u0441\u043b\u0438 \u043a\u043b\u0430\u0441\u0441 \u0443\u0436\u0435 \u043e\u043f\u0438\u0441\u0430\u043d:  <\/p>\n<pre><code class=\"javascript\">this._selector(\u2018activeButton\u2019); \/\/ returns \u2018.button_active\u2019 <\/code><\/pre>\n<p>\u0430 \u043c\u043e\u0436\u043d\u043e \u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043f\u043e\u0438\u0441\u043a\u0430\u0442\u044c:  <\/p>\n<pre><code class=\"javascript\">this._elem(\u2018activeButton\u2019); <\/code><\/pre>\n<p>\u0422\u043e\u043b\u044c\u043a\u043e \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e \u043a\u0435\u0448, \u0432\u0435\u0434\u044c \u0430\u043a\u0442\u0438\u0432\u043d\u0430\u044f \u043a\u043d\u043e\u043f\u043a\u0430 \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f  <\/p>\n<pre><code class=\"javascript\">this._findElem(\u2018activeButton\u2019); <\/code><\/pre>\n<p>  <\/p>\n<h2>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u0430\u044f: \u043a\u043e\u0433\u0434\u0430 \u0432\u0441\u0451 \u0441\u043b\u043e\u0436\u043d\u043e<\/h2>\n<p>  \u0411\u044b\u0432\u0430\u0435\u0442, \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u044b \u0438 \u043a\u043b\u0430\u0441\u0441\u044b \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438:  <\/p>\n<pre><code class=\"javascript\">var id = 5,     state = \u2018highlighted\u2019; $(\u2018.item[data-id=\u201d\u2019 + id + \u2019\u201d]\u2019).addClass(\u2018item_state_\u2019 + state); <\/code><\/pre>\n<p>\u0422\u0443\u0442 \u0432 \u0434\u0435\u043b\u043e \u0432\u0441\u0442\u0443\u043f\u0430\u044e\u0442 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u044b:  <\/p>\n<pre><code class=\"javascript\">_classes: function () {     return {         itemInState: 'item_state_%s'     }; },  _selectors: function () {     return {         itemById: '.item[data-id=%s]'     }; } <\/code><\/pre>\n<p>\u0422\u043e\u0433\u0434\u0430 \u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:  <\/p>\n<pre><code class=\"javascript\">this._class(\u2018itemInState\u2019, \u2018highlighted\u2019); \/\/ \u0432\u0435\u0440\u043d\u0435\u0442 \u2018item_state_highlighted\u2019 this._selector(\u2018itemInState\u2019, \u2018highlighted\u2019); \/\/ \u0432\u0435\u0440\u043d\u0435\u0442 \u2018.item_state_highlighted\u2019 this._selector(\u2018itemById\u2019, 5); \/\/ \u0432\u0435\u0440\u043d\u0435\u0442 \u2018.item[data-id=5]\u2019 <\/code><\/pre>\n<p>  \u0410 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u0430\u044f \u0432\u044b\u0448\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:  <\/p>\n<pre><code class=\"javascript\">var id = 5,     state = \u2018highlighted\u2019; this._addClass([\u2018itemInState\u2019, state], [\u2018itemById\u2019, id]); <\/code><\/pre>\n<p>\u041a\u043b\u0430\u0441\u0441 item_state_highlighted \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u0441\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443, \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u043e\u043c\u0443 \u043f\u043e \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u0443 .item[data-id=5]<\/p>\n<h3>\u0422\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u043e\u0432<\/h3>\n<p>  <\/p>\n<pre><code class=\"javascript\">_classes: function () {     return {         item: 'item_%(mod)s_%(value)s'     }; } <\/code><\/pre>\n<p>\u041a\u0430\u0436\u0434\u043e\u043c\u0443 \u043c\u0435\u0441\u0442\u0443 \u0441\u0432\u043e\u0435 \u0438\u043c\u044f  <\/p>\n<pre><code class=\"javascript\">this._elem(\u2018item\u2019, {   mod: \u2018state\u2019,   value: \u2018focused\u2019 }); <\/code><\/pre>\n<p>\u041d\u0430\u0439\u0434\u0435\u0442 jQuery \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u043f\u043e \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u0443 <code>\u2018.item_state_focused\u2019<\/code><\/p>\n<h2>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043f\u044f\u0442\u0430\u044f: \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/h2>\n<p>  \u041d\u0435\u043c\u043d\u043e\u0436\u043a\u043e \u0441\u0430\u0445\u0430\u0440\u0430 \u0434\u043b\u044f \u0434\u0430\u0442\u0430 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432.  <\/p>\n<pre><code class=\"javascript\">this._data; <\/code><\/pre>\n<p>\u0425\u0440\u0430\u043d\u0438\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0432\u044c\u044e. \u0422\u0430\u043a \u0447\u0442\u043e, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c <code>div<\/code>  <\/p>\n<pre><code class=\"html\">&lt;div data-some-ids=\u201d[5,6,7]\u201d&gt;&lt;\/div&gt; <\/code><\/pre>\n<p>\u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0432\u044c\u044e  <\/p>\n<pre><code class=\"javascript\">this._data[\u2018someIds\u2019]; \/\/ \u0432\u0435\u0440\u043d\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 [5,6,7] <\/code><\/pre>\n<p>\u0410 \u0435\u0441\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0435, \u0442\u043e \u0432\u0430\u043c \u043f\u043e\u043c\u043e\u0436\u0435\u0442  <\/p>\n<pre><code class=\"javascript\">this._getElemData(\u2018elemName\u2019, \u2018someIds\u2019); <\/code><\/pre>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435:  <\/p>\n<pre><code class=\"javascript\">this._getElemData(\u2018elemName\u2019); \/\/ \u0432\u0435\u0440\u043d\u0435\u0442 {someIds: [5,6,7]} <\/code><\/pre>\n<h2>\u041f\u0440\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435<\/h2>\n<p>  GitHub: <a href=\"https:\/\/github.com\/backbonex\/backbone.view.elements\">github.com\/backbonex\/backbone.view.elements<\/a><br \/>  <a href=\"https:\/\/github.com\/backbonex\/todomvc\/commit\/0745cc597fa1b089a23e5b4ee3d0d583b829bb0d\">todomvc \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Backbone.View.Elements \u0438 \u0431\u0435\u0437 \u043d\u0435\u0433\u043e<\/a>      \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\/249373\/\"> http:\/\/habrahabr.ru\/post\/249373\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">     \t\u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0435 \u043f\u0440\u043e \u0432\u0430\u0448\u0438 \u0441\u043b\u0430\u0434\u043a\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b \u043d\u0430 \u0440\u0435\u0430\u043a\u0442\u0435, \u0430\u043d\u0433\u0443\u043b\u044f\u0440\u0435 \u0438\u043b\u0438 \u0447\u0442\u043e \u0432\u044b \u0442\u0430\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435? \u042d\u0442\u043e \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u0440\u043e \u0442\u0435 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438, \u043a\u043e\u0433\u0434\u0430 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043a\u0443\u0447\u043a\u0430 jQuery \u043b\u0430\u043f\u0448\u0438. \u041d\u0435\u0442, \u043f\u0443\u0441\u0442\u044c \u044d\u0442\u043e \u0431\u0443\u0434\u0443\u0442 \u0433\u043e\u0440\u044b jQuery \u043b\u0430\u043f\u0448\u0438, \u0437\u0430\u0432\u0435\u0440\u043d\u0443\u0442\u043e\u0439 \u0432\u043e \u0432\u044c\u044e\u0448\u043a\u0438 \u0431\u044d\u043a\u0431\u043e\u043d\u0430.<\/p>\n<p>  <sup>\u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <a href=\"https:\/\/github.com\/backbonex\/backbone.view.elements\">\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 Backbone.View.Elements<\/a><\/sup><\/p>\n<h2>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043f\u0435\u0440\u0432\u0430\u044f: \u043c\u0430\u043b\u043e\u0432\u044b\u0440\u0430\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u044b<\/h2>\n<p>  \u0412\u0441\u0435 \u043c\u044b \u0432\u0438\u0434\u0435\u043b\u0438 \u043b\u0430\u043f\u0448\u0443, \u0432\u0441\u0435 \u043c\u044b \u0437\u043d\u0430\u0435\u043c: \u043b\u0430\u043f\u0448\u0430 \u0432 JS\u0435 \u2014 \u043d\u0430\u0432\u0435\u0440\u043d\u043e \u0438 \u0432 \u0432\u0435\u0440\u0441\u0442\u043a\u0435 \u043d\u0435 \u0432\u0441\u0435 \u0445\u043e\u0440\u043e\u0448\u043e. \u0410 \u0440\u0430\u0437 \u0432\u0441\u0435 \u0442\u0430\u043a, \u0442\u043e \u043a\u043e\u0434, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u043a\u0438\u0448\u0438\u0442 \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u044b\u043c\u0438 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u044f\u043c\u0438 \u0441 \u0434\u043e\u043c\u043e\u043c. \u0427\u0438\u0442\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434 \u0441\u043b\u043e\u0436\u043d\u043e, \u0432\u0435\u0434\u044c \u043d\u0430\u0434\u043e, \u043d\u0435 \u0443\u043f\u0443\u0441\u043a\u0430\u044f \u043c\u044b\u0441\u043b\u0438 \u0430\u0432\u0442\u043e\u0440\u0430 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u0432\u043e\u043e\u0431\u0449\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442, \u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0432 \u0443\u043c\u0435 \u043a\u0443\u0447\u043a\u0443 \u043d\u0435\u0432\u043d\u044f\u0442\u043d\u044b\u0445 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0439 \u0434\u043b\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432. \u0418\u0442\u0430\u043a, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u0438\u0434\u0430\u0434\u0438\u043c \u043a\u043e\u0434\u0443 \u043d\u0435\u043c\u043d\u043e\u0436\u043a\u043e \u0432\u044b\u0440\u0430\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438:  <\/p>\n<pre><code class=\"javascript\">_selectors: function () {     return {         elemName: '.block__elem-name'     }; } <\/code><\/pre>\n<p>\u0421\u043b\u043e\u0436\u0438\u043c \u0432\u0441\u0435 \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u044b \u0432 \u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u0438 \u0434\u0430\u0434\u0438\u043c \u043f\u043e\u043d\u044f\u0442\u043d\u043e\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c, \u0434\u043b\u044f \u0432\u044b\u0431\u043e\u0440\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u043d\u0438 \u043d\u0443\u0436\u043d\u044b. \u0412\u044b\u0431\u0438\u0440\u0430\u0442\u044c \u043c\u044b \u0438\u0445, \u043a\u0441\u0442\u0430\u0442\u0438, \u0431\u0443\u0434\u0435\u043c \u0432\u043e\u0442 \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"javascript\">this._elem('elemName'); <\/code><\/pre>\n<p>\u0432\u043c\u0441\u0435\u0442\u043e  <\/p>\n<pre><code class=\"javascript\">this.$('.block__elem-name'); <\/code><\/pre>\n<p>  <\/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-249373","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/249373","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=249373"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/249373\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=249373"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=249373"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=249373"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}