3 Polymer('core-slide', {
12 this.setAttribute('nolayout', '');
15 attached: function() {
16 this.target
= this.parentNode
;
19 targetIdChanged: function() {
20 var p
= this.parentNode
;
21 while (p
.parentNode
) {p
= p
.parentNode
;};
22 this.target
= p
.querySelector('#' + this.targetId
);
25 targetChanged: function() {
27 this.asyncMethod(this.update
);
32 this.open
= !this.open
;
35 closedChanged: function() {
36 this.open
= !this.closed
;
39 openChanged: function() {
40 this.asyncMethod(this.update
);
44 this.closed
= !this.open
;
47 if (this.target
.style
.top
!== '') {
53 if (this.target
.style
.left
!== '') {
62 updateLeft: function() {
63 var w
= this.target
.offsetWidth
;
64 var l
= this.open
? 0 : -w
;
65 this.target
.style
.left
= l
+ 'px';
66 var s
= this.target
.nextElementSibling
;
68 if (!s
.hasAttribute('nolayout')) {
69 if (s
.style
.left
=== '' && s
.style
.right
!== '') {
73 s
.style
.left
= l
+ 'px';
76 s
= s
.nextElementSibling
;
80 updateRight: function() {
81 var w
= this.target
.offsetWidth
;
82 var r
= this.open
? 0 : -w
;
83 this.target
.style
.right
= r
+ 'px';
84 //var s = this.target.previousElementSibling;
85 var s
= previousElementSibling(this.target
);
87 if (!s
.hasAttribute('nolayout')) {
88 if (s
.style
.right
=== '' && s
.style
.left
!== '') {
92 s
.style
.right
= r
+ 'px';
95 //if (s == s.previousElementSibling) {
96 // console.error(s.localName + ' is its own sibling', s);
99 //s = s.previousElementSibling;
100 s
= previousElementSibling(s
);
104 updateTop: function() {
105 var h
= this.target
.offsetHeight
;
106 var t
= this.open
? 0 : -h
;
107 this.target
.style
.top
= t
+ 'px';
108 var s
= this.target
.nextElementSibling
;
110 if (!s
.hasAttribute('nolayout')) {
111 if (s
.style
.top
=== '' && s
.style
.bottom
!== '') {
115 s
.style
.top
= t
+ 'px';
118 s
= s
.nextElementSibling
;
122 updateBottom: function() {
123 var h
= this.target
.offsetHeight
;
124 var b
= this.open
? 0 : -h
;
125 this.target
.style
.bottom
= b
+ 'px';
126 //var s = this.target.previousElementSibling;
127 var s
= previousElementSibling(this.target
);
129 if (!s
.hasAttribute('nolayout')) {
130 if (s
.style
.bottom
=== '' && s
.style
.top
!== '') {
134 s
.style
.bottom
= b
+ 'px';
137 //if (s == s.previousElementSibling) {
138 // console.error(s.localName + ' is its own sibling', s);
141 //s = s.previousElementSibling;
142 s
= previousElementSibling(s
);
148 // TODO(sjmiles): temporary workaround for b0rked property in ShadowDOMPolyfill
149 function previousElementSibling(e
) {
151 e
= e
.previousSibling
;
152 } while (e
&& e
.nodeType
!== Node
.ELEMENT_NODE
);