Skip to content

Commit

Permalink
Merge pull request #518 from bem/fix/no-live-ua
Browse files Browse the repository at this point in the history
Don't live initialize i-ua
  • Loading branch information
tadatuta committed Jun 6, 2014
2 parents 96cb2f0 + 08325ab commit cdab9c9
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 70 deletions.
21 changes: 11 additions & 10 deletions blocks-common/i-ua/_interaction/i-ua_interaction_yes.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,23 @@
modName: 'interaction',
modVal: 'yes' }, {

onSetMod: {
js: {
inited: function() {
this.bindTo('mousedown', this._onPointer)
.bindTo('keydown', this._onKeyboard);
}
}
},

/**
* @private
*/
_onPointer: function() {
this.interaction = 'pointer';
this.domElem.attr('data-interaction', 'pointer');

this.__self.liveUnbindFrom('mousedown', this._onPointer);
this.unbindFrom('mousedown', this._onPointer);
},

/**
Expand All @@ -62,15 +71,7 @@
this.domElem.attr('data-interaction', 'keyboard');
this.interaction = 'keyboard';

this.__self.liveBindTo('mousedown', this._onPointer);
}

}, {

live: function() {
this
.liveBindTo('mousedown', this.prototype._onPointer)
.liveBindTo('keydown', this.prototype._onKeyboard);
this.bindTo('mousedown', this._onPointer);
}

});
Expand Down
117 changes: 57 additions & 60 deletions blocks-touch/b-page/b-page.bemhtml
Original file line number Diff line number Diff line change
@@ -1,67 +1,64 @@
block b-page {
default: {
this._buf.push('<!DOCTYPE html>');
apply({
_mode: '',
ctx: {
elem: 'root',
content: [
{
elem: 'head',
content: [
{
elem: 'meta',
attrs: {
charset: 'utf-8'
}
},
{
tag: 'title',
content: this.ctx.title
},
{
elem: 'meta',
attrs: {
name: 'viewport',
content: this.ctx.zoom ?
'width=device-width,initial-scale=1' :
'width=device-width,maximum-scale=1,initial-scale=1,user-scalable=0'
}
},
{
elem: 'meta',
attrs: {
name: 'format-detection',
content: 'telephone=no'
}
},
{
elem: 'link',
attrs: {
name: 'apple-mobile-web-app-capable',
content: 'yes'
}
},
{
block: 'i-ua',
js: true
},
this.ctx.head
]
},
{
elem: 'body',
mix: [
this.ctx,
{
block: 'i-ua',
js: true
applyCtx({
elem: 'root',
content: [
{
elem: 'head',
content: [
{
elem: 'meta',
attrs: {
charset: 'utf-8'
}
].concat(this.ctx.mix || []),
content: this.ctx.content
}
]
}
},
{
tag: 'title',
content: this.ctx.title
},
{
elem: 'meta',
attrs: {
name: 'viewport',
content: this.ctx.zoom ?
'width=device-width,initial-scale=1' :
'width=device-width,maximum-scale=1,initial-scale=1,user-scalable=0'
}
},
{
elem: 'meta',
attrs: {
name: 'format-detection',
content: 'telephone=no'
}
},
{
elem: 'link',
attrs: {
name: 'apple-mobile-web-app-capable',
content: 'yes'
}
},
{
block: 'i-ua',
js: true
},
this.ctx.head
]
},
{
elem: 'body',
mix: [
this.ctx,
{
block: 'i-ua',
js: true
}
].concat(apply('mix') || [], this.ctx.mix || []),
content: this.ctx.content
}
]
})
}

Expand Down

0 comments on commit cdab9c9

Please sign in to comment.