From 795aa0af31583a93dcacb387fe377d53b9d0477a Mon Sep 17 00:00:00 2001 From: Trevor Burnham Date: Thu, 6 Feb 2014 17:50:28 -0500 Subject: [PATCH 1/2] Allow tabbing to work in Safari Mobile --- coffee/select.coffee | 11 +++++++---- css/select-theme-chosen.css | 11 ++++++----- css/select-theme-dark.css | 11 ++++++----- css/select-theme-default.css | 11 ++++++----- js/select.js | 6 +++++- sass/_select.sass | 6 ++++-- select.js | 12 ++++++++---- select.min.js | 2 +- 8 files changed, 43 insertions(+), 27 deletions(-) diff --git a/coffee/select.coffee b/coffee/select.coffee index 2904dc3..a1b72d2 100644 --- a/coffee/select.coffee +++ b/coffee/select.coffee @@ -49,7 +49,7 @@ document.addEventListener 'keypress', (e) -> # They hit the same char over and over, maybe they want to cycle through # the options that start with that char repeatedOptions = select.findOptionsByPrefix(searchText[0]) - + if repeatedOptions.length selected = repeatedOptions.indexOf select.getChosen() @@ -67,7 +67,7 @@ document.addEventListener 'keypress', (e) -> return # No match at all, do nothing - + document.addEventListener 'keydown', (e) -> # We consider this independently of the keypress handler so we can intercept keys that have # built-in functions. @@ -108,7 +108,7 @@ class Select extends Evented @renderDrop() @setupSelect() - + @setupTether() @bindClick() @@ -293,7 +293,10 @@ class Select extends Evented setupSelect: -> @select.selectInstance = @ - addClass @select, 'select-select' + if @useNative() + addClass @select, 'select-select-native' + else + addClass @select, 'select-select' @select.addEventListener 'change', => @renderDrop() diff --git a/css/select-theme-chosen.css b/css/select-theme-chosen.css index 63d3e7b..47aa988 100644 --- a/css/select-theme-chosen.css +++ b/css/select-theme-chosen.css @@ -1,11 +1,12 @@ .select-select { - display: none; + display: none; } + +.select-select-native { /* For when we are on a small touch device and want to use native controls */ - -webkit-pointer-events: none; - -moz-pointer-events: none; - pointer-events: none; position: absolute; - opacity: 0; } + width: 0; + height: 0; + overflow: hidden; } .select-element, .select-element:after, .select-element:before, .select-element *, .select-element *:after, .select-element *:before { -webkit-box-sizing: border-box; diff --git a/css/select-theme-dark.css b/css/select-theme-dark.css index 8ac1177..4add2ba 100644 --- a/css/select-theme-dark.css +++ b/css/select-theme-dark.css @@ -1,11 +1,12 @@ .select-select { - display: none; + display: none; } + +.select-select-native { /* For when we are on a small touch device and want to use native controls */ - -webkit-pointer-events: none; - -moz-pointer-events: none; - pointer-events: none; position: absolute; - opacity: 0; } + width: 0; + height: 0; + overflow: hidden; } .select-element, .select-element:after, .select-element:before, .select-element *, .select-element *:after, .select-element *:before { -webkit-box-sizing: border-box; diff --git a/css/select-theme-default.css b/css/select-theme-default.css index 5fc824f..c8ccd44 100644 --- a/css/select-theme-default.css +++ b/css/select-theme-default.css @@ -1,11 +1,12 @@ .select-select { - display: none; + display: none; } + +.select-select-native { /* For when we are on a small touch device and want to use native controls */ - -webkit-pointer-events: none; - -moz-pointer-events: none; - pointer-events: none; position: absolute; - opacity: 0; } + width: 0; + height: 0; + overflow: hidden; } .select-element, .select-element:after, .select-element:before, .select-element *, .select-element *:after, .select-element *:before { -webkit-box-sizing: border-box; diff --git a/js/select.js b/js/select.js index 3b7577a..01de861 100644 --- a/js/select.js +++ b/js/select.js @@ -326,7 +326,11 @@ Select.prototype.setupSelect = function() { var _this = this; this.select.selectInstance = this; - addClass(this.select, 'select-select'); + if (this.useNative()) { + addClass(this.select, 'select-select-native'); + } else { + addClass(this.select, 'select-select'); + } return this.select.addEventListener('change', function() { _this.renderDrop(); return _this.renderTarget(); diff --git a/sass/_select.sass b/sass/_select.sass index 07cfea8..40f9cb5 100644 --- a/sass/_select.sass +++ b/sass/_select.sass @@ -3,7 +3,9 @@ .select-select display: none +.select-select-native /* For when we are on a small touch device and want to use native controls */ - +pointer-events(none) position: absolute - opacity: 0 + width: 0 + height: 0 + overflow: hidden diff --git a/select.js b/select.js index fc0c957..a3c387e 100644 --- a/select.js +++ b/select.js @@ -1,5 +1,5 @@ /*! select 0.4.8 */ -/*! tether 0.5.0 */ +/*! tether 0.5.2 */ (function() { var Evented, addClass, defer, deferred, extend, flush, getBounds, getOffsetParent, getOrigin, getScrollParent, hasClass, node, removeClass, uniqueId, updateClasses, zeroPosCache, __hasProp = {}.hasOwnProperty, @@ -612,7 +612,7 @@ if (this.target !== document.body) { out.height = Math.max(out.height, 24); } - scrollPercentage = target.scrollTop / (target.scrollHeight - height); + scrollPercentage = this.target.scrollTop / (target.scrollHeight - height); out.top = scrollPercentage * (height - out.height - fitAdj) + bounds.top + parseFloat(style.borderTopWidth); if (this.target === document.body) { out.height = Math.max(out.height, 24); @@ -814,7 +814,7 @@ _ref4 = ['Top', 'Left', 'Bottom', 'Right']; for (_j = 0, _len1 = _ref4.length; _j < _len1; _j++) { side = _ref4[_j]; - offsetBorder[side] = parseFloat(offsetParentStyle["border" + side + "Width"]); + offsetBorder[side.toLowerCase()] = parseFloat(offsetParentStyle["border" + side + "Width"]); } offsetPosition.right = document.body.scrollWidth - offsetPosition.left - offsetParentSize.width + offsetBorder.right; offsetPosition.bottom = document.body.scrollHeight - offsetPosition.top - offsetParentSize.height + offsetBorder.bottom; @@ -1685,7 +1685,11 @@ Select.prototype.setupSelect = function() { var _this = this; this.select.selectInstance = this; - addClass(this.select, 'select-select'); + if (this.useNative()) { + addClass(this.select, 'select-select-native'); + } else { + addClass(this.select, 'select-select'); + } return this.select.addEventListener('change', function() { _this.renderDrop(); return _this.renderTarget(); diff --git a/select.min.js b/select.min.js index 3bb6035..8e5d49b 100644 --- a/select.min.js +++ b/select.min.js @@ -1,2 +1,2 @@ /*! select 0.4.8 */ -(function(){var t,e,o,i,n,r,s,l,h,a,p,u,c,f,d,g,m={}.hasOwnProperty,v=[].indexOf||function(t){for(var e=0,o=this.length;o>e;e++)if(e in this&&this[e]===t)return e;return-1},b=[].slice;null==window.Tether&&(window.Tether={}),a=function(t){var e,o,i,n,r;if(o=getComputedStyle(t).position,"fixed"===o)return t;for(i=void 0,e=t;e=e.parentNode;){try{n=getComputedStyle(e)}catch(s){}if(null==n)return e;if(/(auto|scroll)/.test(n.overflow+n["overflow-y"]+n["overflow-x"])&&("absolute"!==o||"relative"===(r=n.position)||"absolute"===r||"fixed"===r))return e}return document.body},f=function(){var t;return t=0,function(){return t++}}(),g={},h=function(t){var e,i,r,s,l;if(r=t._tetherZeroElement,null==r&&(r=t.createElement("div"),r.setAttribute("data-tether-id",f()),n(r.style,{top:0,left:0,position:"absolute"}),t.body.appendChild(r),t._tetherZeroElement=r),e=r.getAttribute("data-tether-id"),null==g[e]){g[e]={},l=r.getBoundingClientRect();for(i in l)s=l[i],g[e][i]=s;o(function(){return g[e]=void 0})}return g[e]},u=null,s=function(t){var e,o,i,n,r,s,l;t===document?(o=document,t=document.documentElement):o=t.ownerDocument,i=o.documentElement,e={},l=t.getBoundingClientRect();for(n in l)s=l[n],e[n]=s;return r=h(o),e.top-=r.top,e.left-=r.left,null==e.width&&(e.width=document.body.scrollWidth-e.left-e.right),null==e.height&&(e.height=document.body.scrollHeight-e.top-e.bottom),e.top=e.top-i.clientTop,e.left=e.left-i.clientLeft,e.right=o.body.clientWidth-e.width-e.left,e.bottom=o.body.clientHeight-e.height-e.top,e},l=function(t){return t.offsetParent||document.documentElement},n=function(t){var e,o,i,n,r,s,l;for(null==t&&(t={}),e=[],Array.prototype.push.apply(e,arguments),l=e.slice(1),r=0,s=l.length;s>r;r++)if(i=l[r])for(o in i)m.call(i,o)&&(n=i[o],t[o]=n);return t},c=function(t,e){var o,i,n,r,s;if(null!=t.classList){for(r=e.split(" "),s=[],i=0,n=r.length;n>i;i++)o=r[i],s.push(t.classList.remove(o));return s}return t.className=t.className.replace(new RegExp("(^| )"+e.split(" ").join("|")+"( |$)","gi")," ")},e=function(t,e){var o,i,n,r,s;if(null!=t.classList){for(r=e.split(" "),s=[],i=0,n=r.length;n>i;i++)o=r[i],s.push(t.classList.add(o));return s}return c(t,e),t.className+=" "+e},p=function(t,e){return null!=t.classList?t.classList.contains(e):new RegExp("(^| )"+e+"( |$)","gi").test(t.className)},d=function(t,o,i){var n,r,s,l,h,a;for(r=0,l=i.length;l>r;r++)n=i[r],v.call(o,n)<0&&p(t,n)&&c(t,n);for(a=[],s=0,h=o.length;h>s;s++)n=o[s],p(t,n)?a.push(void 0):a.push(e(t,n));return a},i=[],o=function(t){return i.push(t)},r=function(){var t,e;for(e=[];t=i.pop();)e.push(t());return e},t=function(){function t(){}return t.prototype.on=function(t,e,o,i){var n;return null==i&&(i=!1),null==this.bindings&&(this.bindings={}),null==(n=this.bindings)[t]&&(n[t]=[]),this.bindings[t].push({handler:e,ctx:o,once:i})},t.prototype.once=function(t,e,o){return this.on(t,e,o,!0)},t.prototype.off=function(t,e){var o,i,n;if(null!=(null!=(i=this.bindings)?i[t]:void 0)){if(null==e)return delete this.bindings[t];for(o=0,n=[];o=e&&e>=t-o},O=function(){var t,e,o,i,n;for(t=document.createElement("div"),n=["transform","webkitTransform","OTransform","MozTransform","msTransform"],o=0,i=n.length;i>o;o++)if(e=n[o],void 0!==t.style[e])return e}(),w=[],y=function(){var t,e,o;for(e=0,o=w.length;o>e;e++)t=w[e],t.position(!1);return a()},g=function(){var t;return null!=(t="undefined"!=typeof performance&&null!==performance?"function"==typeof performance.now?performance.now():void 0:void 0)?t:+new Date},function(){var t,e,o,i,n,r,s,l,h;for(e=null,o=null,i=null,n=function(){if(null!=o&&o>16)return o=Math.min(o-16,250),i=setTimeout(n,250),void 0;if(!(null!=e&&g()-e<10))return null!=i&&(clearTimeout(i),i=null),e=g(),y(),o=g()-e},l=["resize","scroll","touchmove"],h=[],r=0,s=l.length;s>r;r++)t=l[r],h.push(window.addEventListener(t,n));return h}(),t={center:"center",left:"right",right:"left"},e={middle:"middle",top:"bottom",bottom:"top"},o={top:0,left:0,middle:"50%",center:"50%",bottom:"100%",right:"100%"},s=function(o,i){var n,r;return n=o.left,r=o.top,"auto"===n&&(n=t[i.left]),"auto"===r&&(r=e[i.top]),{left:n,top:r}},r=function(t){var e,i;return{left:null!=(e=o[t.left])?e:t.left,top:null!=(i=o[t.top])?i:t.top}},n=function(){var t,e,o,i,n,r,s;for(e=1<=arguments.length?x.call(arguments,0):[],o={top:0,left:0},n=0,r=e.length;r>n;n++)s=e[n],i=s.top,t=s.left,"string"==typeof i&&(i=parseFloat(i,10)),"string"==typeof t&&(t=parseFloat(t,10)),o.top+=i,o.left+=t;return o},m=function(t,e){return"string"==typeof t.left&&-1!==t.left.indexOf("%")&&(t.left=parseFloat(t.left,10)/100*e.width),"string"==typeof t.top&&-1!==t.top.indexOf("%")&&(t.top=parseFloat(t.top,10)/100*e.height),t},v=b=function(t){var e,o,i;return i=t.split(" "),o=i[0],e=i[1],{top:o,left:e}},S=function(){function t(t){this.position=L(this.position,this);var e,o,i,n,r;for(w.push(this),this.history=[],this.setOptions(t,!1),n=Tether.modules,o=0,i=n.length;i>o;o++)e=n[o],null!=(r=e.initialize)&&r.call(this);this.position()}return t.modules=[],t.prototype.getClass=function(t){var e,o;return(null!=(e=this.options.classes)?e[t]:void 0)?this.options.classes[t]:(null!=(o=this.options.classes)?o[t]:void 0)!==!1?this.options.classPrefix?""+this.options.classPrefix+"-"+t:t:""},t.prototype.setOptions=function(t,e){var o,n,r,s,l,a;for(this.options=t,null==e&&(e=!0),o={offset:"0 0",targetOffset:"0 0",targetAttachment:"auto auto",classPrefix:"tether"},this.options=h(o,this.options),l=this.options,this.element=l.element,this.target=l.target,this.targetModifier=l.targetModifier,"viewport"===this.target?(this.target=document.body,this.targetModifier="visible"):"scroll-handle"===this.target&&(this.target=document.body,this.targetModifier="scroll-handle"),a=["element","target"],r=0,s=a.length;s>r;r++){if(n=a[r],null==this[n])throw new Error("Tether Error: Both element and target must be defined");null!=this[n].jquery?this[n]=this[n][0]:"string"==typeof this[n]&&(this[n]=document.querySelector(this[n]))}if(i(this.element,this.getClass("element")),i(this.target,this.getClass("target")),!this.options.attachment)throw new Error("Tether Error: You must provide an attachment");return this.targetAttachment=v(this.options.targetAttachment),this.attachment=v(this.options.attachment),this.offset=b(this.options.offset),this.targetOffset=b(this.options.targetOffset),null!=this.scrollParent&&this.disable(),this.scrollParent="scroll-handle"===this.targetModifier?this.target:f(this.target),this.options.enabled!==!1?this.enable(e):void 0},t.prototype.getTargetBounds=function(){var t,e,o,i,n,r,s,l,h;if(null==this.targetModifier)return p(this.target);switch(this.targetModifier){case"visible":return this.target===document.body?{top:pageYOffset,left:pageXOffset,height:innerHeight,width:innerWidth}:(t=p(this.target),n={height:t.height,width:t.width,top:t.top,left:t.left},n.height=Math.min(n.height,t.height-(pageYOffset-t.top)),n.height=Math.min(n.height,t.height-(t.top+t.height-(pageYOffset+innerHeight))),n.height=Math.min(innerHeight,n.height),n.height-=2,n.width=Math.min(n.width,t.width-(pageXOffset-t.left)),n.width=Math.min(n.width,t.width-(t.left+t.width-(pageXOffset+innerWidth))),n.width=Math.min(innerWidth,n.width),n.width-=2,n.toph.clientWidth||"scroll"===[l.overflow,l.overflowX]||this.target!==document.body,r=0,o&&(r=15),i=t.height-parseFloat(l.borderTopWidth)-parseFloat(l.borderBottomWidth)-r,n={width:15,height:.975*i*(i/h.scrollHeight),left:t.left+t.width-parseFloat(l.borderLeftWidth)-15},e=0,408>i&&this.target===document.body&&(e=-11e-5*Math.pow(i,2)-.00727*i+22.58),this.target!==document.body&&(n.height=Math.max(n.height,24)),s=h.scrollTop/(h.scrollHeight-i),n.top=s*(i-n.height-e)+t.top+parseFloat(l.borderTopWidth),this.target===document.body&&(n.height=Math.max(n.height,24)),n}},t.prototype.clearCache=function(){return this._cache={}},t.prototype.cache=function(t,e){return null==this._cache&&(this._cache={}),null==this._cache[t]&&(this._cache[t]=e.call(this)),this._cache[t]},t.prototype.enable=function(t){return null==t&&(t=!0),i(this.target,this.getClass("enabled")),i(this.element,this.getClass("enabled")),this.enabled=!0,this.scrollParent!==document&&this.scrollParent.addEventListener("scroll",this.position),t?this.position():void 0},t.prototype.disable=function(){return C(this.target,this.getClass("enabled")),C(this.element,this.getClass("enabled")),this.enabled=!1,null!=this.scrollParent?this.scrollParent.removeEventListener("scroll",this.position):void 0},t.prototype.destroy=function(){var t,e,o,i,n;for(this.disable(),n=[],t=o=0,i=w.length;i>o;t=++o){if(e=w[t],e===this){w.splice(t,1);break}n.push(void 0)}return n},t.prototype.updateAttachClasses=function(t,e){var o,i,n,r,s,h,a,p,u,c=this;for(null==t&&(t=this.attachment),null==e&&(e=this.targetAttachment),r=["left","top","bottom","right","middle","center"],(null!=(u=this._addAttachClasses)?u.length:void 0)&&this._addAttachClasses.splice(0,this._addAttachClasses.length),o=null!=this._addAttachClasses?this._addAttachClasses:this._addAttachClasses=[],t.top&&o.push(""+this.getClass("element-attached")+"-"+t.top),t.left&&o.push(""+this.getClass("element-attached")+"-"+t.left),e.top&&o.push(""+this.getClass("target-attached")+"-"+e.top),e.left&&o.push(""+this.getClass("target-attached")+"-"+e.left),i=[],s=0,a=r.length;a>s;s++)n=r[s],i.push(""+this.getClass("element-attached")+"-"+n);for(h=0,p=r.length;p>h;h++)n=r[h],i.push(""+this.getClass("target-attached")+"-"+n);return l(function(){return null!=c._addAttachClasses?(T(c.element,c._addAttachClasses,i),T(c.target,c._addAttachClasses,i),c._addAttachClasses=void 0):void 0})},t.prototype.position=function(t){var e,o,i,l,h,c,f,d,g,v,b,y,C,w,O,T,E,S,A,x,L,H,M,B,P,k,_,N,W,q,D,F,z=this;if(null==t&&(t=!0),this.enabled){for(this.clearCache(),A=s(this.targetAttachment,this.attachment),this.updateAttachClasses(this.attachment,A),e=this.cache("element-bounds",function(){return p(z.element)}),B=e.width,i=e.height,0===B&&0===i&&null!=this.lastSize?(W=this.lastSize,B=W.width,i=W.height):this.lastSize={width:B,height:i},H=L=this.cache("target-bounds",function(){return z.getTargetBounds()}),g=m(r(this.attachment),{width:B,height:i}),x=m(r(A),H),h=m(this.offset,{width:B,height:i}),c=m(this.targetOffset,H),g=n(g,h),x=n(x,c),l=L.left+x.left-g.left,M=L.top+x.top-g.top,q=Tether.modules,P=0,_=q.length;_>P;P++)if(f=q[P],O=f.position.call(this,{left:l,top:M,targetAttachment:A,targetPos:L,elementPos:e,offset:g,targetOffset:x,manualOffset:h,manualTargetOffset:c}),null!=O&&"object"==typeof O){if(O===!1)return!1;M=O.top,l=O.left}if(d={page:{top:M,bottom:document.body.scrollHeight-M-i,left:l,right:document.body.scrollWidth-l-B},viewport:{top:M-pageYOffset,bottom:pageYOffset-M-i+innerHeight,left:l-pageXOffset,right:pageXOffset-l-B+innerWidth}},(null!=(D=this.options.optimizations)?D.moveElement:void 0)!==!1&&null==this.targetModifier){for(b=this.cache("target-offsetparent",function(){return u(z.target)}),w=this.cache("target-offsetparent-bounds",function(){return p(b)}),C=getComputedStyle(b),o=getComputedStyle(this.element),y=w,v={},F=["Top","Left","Bottom","Right"],k=0,N=F.length;N>k;k++)S=F[k],v[S]=parseFloat(C["border"+S+"Width"]);w.right=document.body.scrollWidth-w.left-y.width+v.right,w.bottom=document.body.scrollHeight-w.top-y.height+v.bottom,d.page.top>=w.top+v.top&&d.page.bottom>=w.bottom&&d.page.left>=w.left+v.left&&d.page.right>=w.right&&(E=b.scrollTop,T=b.scrollLeft,d.offset={top:d.page.top-w.top+E-v.top,left:d.page.left-w.left+T-v.left})}return this.move(d),this.history.unshift(d),this.history.length>3&&this.history.pop(),t&&a(),!0}},t.prototype.move=function(t){var e,o,i,n,r,s,a,p,c,f,d,g,m,v,b,y,C,w=this;if(null!=this.element.parentNode){p={};for(f in t){p[f]={};for(n in t[f]){for(i=!1,y=this.history,v=0,b=y.length;b>v;v++)if(a=y[v],!E(null!=(C=a[f])?C[n]:void 0,t[f][n])){i=!0;break}i||(p[f][n]=!0)}}e={top:"",left:"",right:"",bottom:""},c=function(t,o){var i,n,r;return(null!=(r=w.options.optimizations)?r.gpu:void 0)===!1?(t.top?e.top=""+o.top+"px":e.bottom=""+o.bottom+"px",t.left?e.left=""+o.left+"px":e.right=""+o.right+"px"):(t.top?(e.top=0,n=o.top):(e.bottom=0,n=-o.bottom),t.left?(e.left=0,i=o.left):(e.right=0,i=-o.right),e[O]="translateX("+Math.round(i)+"px) translateY("+Math.round(n)+"px)","msTransform"!==O?e[O]+=" translateZ(0)":void 0)},r=!1,(p.page.top||p.page.bottom)&&(p.page.left||p.page.right)?(e.position="absolute",c(p.page,t.page)):(p.viewport.top||p.viewport.bottom)&&(p.viewport.left||p.viewport.right)?(e.position="fixed",c(p.viewport,t.viewport)):null!=p.offset&&p.offset.top&&p.offset.left?(e.position="absolute",s=this.cache("target-offsetparent",function(){return u(w.target)}),u(this.element)!==s&&l(function(){return w.element.parentNode.removeChild(w.element),s.appendChild(w.element)}),c(p.offset,t.offset),r=!0):(e.position="absolute",c({top:!0,left:!0},t.page)),r||"BODY"===this.element.parentNode.tagName||(this.element.parentNode.removeChild(this.element),document.body.appendChild(this.element)),m={},g=!1;for(n in e)d=e[n],o=this.element.style[n],""===o||""===d||"top"!==n&&"left"!==n&&"bottom"!==n&&"right"!==n||(o=parseFloat(o),d=parseFloat(d)),o!==d&&(g=!0,m[n]=e[n]);return g?l(function(){return h(w.element.style,m)}):void 0}},t}(),Tether.position=y,window.Tether=h(S,Tether)}.call(this),function(){var t,e,o,i,n,r,s,l,h,a,p=[].indexOf||function(t){for(var e=0,o=this.length;o>e;e++)if(e in this&&this[e]===t)return e;return-1};a=Tether.Utils,s=a.getOuterSize,r=a.getBounds,l=a.getSize,i=a.extend,h=a.updateClasses,o=a.defer,e={left:"right",right:"left",top:"bottom",bottom:"top",middle:"middle"},t=["left","top","right","bottom"],n=function(e,o){var i,n,s,l,h,a,p;if("scrollParent"===o?o=e.scrollParent:"window"===o&&(o=[pageXOffset,pageYOffset,innerWidth+pageXOffset,innerHeight+pageYOffset]),o===document&&(o=o.documentElement),null!=o.nodeType)for(n=l=r(o),h=getComputedStyle(o),o=[n.left,n.top,l.width+n.left,l.height+n.top],i=a=0,p=t.length;p>a;i=++a)s=t[i],s=s[0].toUpperCase()+s.substr(1),"Top"===s||"Left"===s?o[i]+=parseFloat(h["border"+s+"Width"]):o[i]-=parseFloat(h["border"+s+"Width"]);return o},Tether.modules.push({position:function(e){var s,l,a,u,c,f,d,g,m,v,b,y,C,w,O,T,E,S,A,x,L,H,M,B,P,k,_,N,W,q,D,F,z,Y,X,j,I,U,R,Z,V,$,G,J,K,Q,te,ee=this;if(k=e.top,b=e.left,L=e.targetAttachment,!this.options.constraints)return!0;for(S=function(e){var o,i,n,r;for(ee.removeClass(e),r=[],i=0,n=t.length;n>i;i++)o=t[i],r.push(ee.removeClass(""+e+"-"+o));return r},Z=this.cache("element-bounds",function(){return r(ee.element)}),v=Z.height,_=Z.width,0===_&&0===v&&null!=this.lastSize&&(V=this.lastSize,_=V.width,v=V.height),M=this.cache("target-bounds",function(){return ee.getTargetBounds()}),H=M.height,B=M.width,x={},m={},l=[this.getClass("pinned"),this.getClass("out-of-bounds")],$=this.options.constraints,N=0,F=$.length;F>N;N++)g=$[N],g.outOfBoundsClass&&l.push(g.outOfBoundsClass),g.pinnedClass&&l.push(g.pinnedClass);for(W=0,z=l.length;z>W;W++)for(d=l[W],G=["left","top","right","bottom"],q=0,Y=G.length;Y>q;q++)A=G[q],l.push(""+d+"-"+A);for(s=[],x=i({},L),m=i({},this.attachment),J=this.options.constraints,D=0,X=J.length;X>D;D++){if(g=J[D],P=g.to,a=g.attachment,O=g.pin,null==a&&(a=""),p.call(a," ")>=0?(K=a.split(" "),f=K[0],c=K[1]):c=f=a,u=n(this,P),("target"===f||"both"===f)&&(ku[3]&&"bottom"===x.top&&(k-=H,x.top="top")),"together"===f&&(ku[3]&&"bottom"===x.top&&("top"===m.top?(k-=H,x.top="top",k-=v,m.top="bottom"):"bottom"===m.top&&(k-=H,x.top="top",k+=v,m.top="top"))),("target"===c||"both"===c)&&(bu[2]&&"right"===x.left&&(b-=B,x.left="left")),"together"===c&&(bu[2]&&"right"===x.left&&("left"===m.left?(b-=B,x.left="left",b-=_,m.left="right"):"right"===m.left&&(b-=B,x.left="left",b+=_,m.left="left"))),("element"===f||"both"===f)&&(ku[3]&&"top"===m.top&&(k-=v,m.top="bottom")),("element"===c||"both"===c)&&(bu[2]&&"left"===m.left&&(b-=_,m.left="right")),"string"==typeof O?O=function(){var t,e,o,i;for(o=O.split(","),i=[],e=0,t=o.length;t>e;e++)w=o[e],i.push(w.trim());return i}():O===!0&&(O=["top","left","right","bottom"]),O||(O=[]),T=[],y=[],k=0?(k=u[1],T.push("top")):y.push("top")),k+v>u[3]&&(p.call(O,"bottom")>=0?(k=u[3]-v,T.push("bottom")):y.push("bottom")),b=0?(b=u[0],T.push("left")):y.push("left")),b+_>u[2]&&(p.call(O,"right")>=0?(b=u[2]-_,T.push("right")):y.push("right")),T.length)for(E=null!=(Q=this.options.pinnedClass)?Q:this.getClass("pinned"),s.push(E),U=0,j=T.length;j>U;U++)A=T[U],s.push(""+E+"-"+A);if(y.length)for(C=null!=(te=this.options.outOfBoundsClass)?te:this.getClass("out-of-bounds"),s.push(C),R=0,I=y.length;I>R;R++)A=y[R],s.push(""+C+"-"+A);(p.call(T,"left")>=0||p.call(T,"right")>=0)&&(m.left=x.left=!1),(p.call(T,"top")>=0||p.call(T,"bottom")>=0)&&(m.top=x.top=!1),(x.top!==L.top||x.left!==L.left||m.top!==this.attachment.top||m.left!==this.attachment.left)&&this.updateAttachClasses(m,x)}return o(function(){return h(ee.target,s,l),h(ee.element,s,l)}),{top:k,left:b}}})}.call(this),function(){var t,e,o,i;i=Tether.Utils,e=i.getBounds,o=i.updateClasses,t=i.defer,Tether.modules.push({position:function(i){var n,r,s,l,h,a,p,u,c,f,d,g,m,v,b,y,C,w,O,T,E,S,A,x,L,H=this;if(d=i.top,a=i.left,E=this.cache("element-bounds",function(){return e(H.element)}),h=E.height,g=E.width,f=this.getTargetBounds(),l=d+h,p=a+g,n=[],d<=f.bottom&&l>=f.top)for(S=["left","right"],m=0,C=S.length;C>m;m++)u=S[m],((A=f[u])===a||A===p)&&n.push(u);if(a<=f.right&&p>=f.left)for(x=["top","bottom"],v=0,w=x.length;w>v;v++)u=x[v],((L=f[u])===d||L===l)&&n.push(u);for(s=[],r=[],c=["left","top","right","bottom"],s.push(this.getClass("abutted")),b=0,O=c.length;O>b;b++)u=c[b],s.push(""+this.getClass("abutted")+"-"+u);for(n.length&&r.push(this.getClass("abutted")),y=0,T=n.length;T>y;y++)u=n[y],r.push(""+this.getClass("abutted")+"-"+u);return t(function(){return o(H.target,r,s),o(H.element,r,s)}),!0}})}.call(this),function(){Tether.modules.push({position:function(t){var e,o,i,n,r,s,l;return s=t.top,e=t.left,this.options.shift?(o=function(t){return"function"==typeof t?t.call(this,{top:s,left:e}):t},i=o(this.options.shift),"string"==typeof i?(i=i.split(" "),i[1]||(i[1]=i[0]),r=i[0],n=i[1],r=parseFloat(r,10),n=parseFloat(n,10)):(l=[i.top,i.left],r=l[0],n=l[1]),s+=r,e+=n,{top:s,left:e}):void 0}})}.call(this),function(){var t,e,o,i,n,r,s,l,h,a,p,u,c,f,d,g,m,v,b,y,C,w={}.hasOwnProperty,O=function(t,e){function o(){this.constructor=t}for(var i in e)w.call(e,i)&&(t[i]=e[i]);return o.prototype=e.prototype,t.prototype=new o,t.__super__=e.prototype,t};C=Tether.Utils,a=C.extend,l=C.addClass,g=C.removeClass,c=C.hasClass,p=C.getBounds,i=C.Evented,e=13,o=27,n=32,s=38,t=40,b="ontouchstart"in document.documentElement,h=b?"touchstart":"click",y=function(){return b&&(640>=innerWidth||640>=innerHeight)},f=function(t){return Array.prototype.reduce.call(t,function(t,e){return t===e?e:!1})},u=function(){var t;return null!=(t=document.querySelector(".select-target-focused"))?t.selectInstance:void 0},m="",v=void 0,d=void 0,document.addEventListener("keypress",function(t){var e,o,i,r;if((i=u())&&0!==t.charCode)return t.keyCode===n&&t.preventDefault(),clearTimeout(v),v=setTimeout(function(){return m=""},500),m+=String.fromCharCode(t.charCode),e=i.findOptionsByPrefix(m),1===e.length?(i.selectOption(e[0]),void 0):m.length>1&&f(m)&&(o=i.findOptionsByPrefix(m[0]),o.length)?(r=o.indexOf(i.getChosen()),r+=1,r%=o.length,i.selectOption(o[r]),void 0):(e.length&&i.selectOption(e[0]),void 0)}),document.addEventListener("keydown",function(i){var r,l,h;if(r=u())if(((l=i.keyCode)===s||l===t||l===o)&&i.preventDefault(),r.isOpen())switch(i.keyCode){case s:case t:return r.moveHighlight(i.keyCode);case e:return r.selectHighlightedOption();case o:return r.close(),r.target.focus()}else if((h=i.keyCode)===s||h===t||h===n)return r.open()}),r=function(t){function e(t){if(this.options=t,this.options=a({},e.defaults,this.options),this.select=this.options.el,null!=this.select.selectInstance)throw new Error("This element has already been turned into a Select");this.setupTarget(),this.renderTarget(),this.setupDrop(),this.renderDrop(),this.setupSelect(),this.setupTether(),this.bindClick(),this.value=this.select.value}return O(e,t),e.defaults={alignToHighlighed:"auto",className:"select-theme-default"},e.prototype.useNative=function(){return this.options.useNative===!0||y()&&this.options.useNative!==!1},e.prototype.setupTarget=function(){var t,e=this;return this.target=document.createElement("a"),this.target.href="javascript:;",l(this.target,"select-target"),t=this.select.getAttribute("tabindex")||0,this.target.setAttribute("tabindex",t),this.options.className&&l(this.target,this.options.className),this.target.selectInstance=this,this.target.addEventListener("click",function(){return e.isOpen()?e.target.blur():e.target.focus()}),this.target.addEventListener("focus",function(){return l(e.target,"select-target-focused")}),this.target.addEventListener("blur",function(t){return e.isOpen()&&t.relatedTarget&&!e.drop.contains(t.relatedTarget)&&e.close(),g(e.target,"select-target-focused")}),this.select.parentNode.insertBefore(this.target,this.select.nextSibling)},e.prototype.setupDrop=function(){var t=this;return this.drop=document.createElement("div"),l(this.drop,"select"),this.options.className&&l(this.drop,this.options.className),document.body.appendChild(this.drop),this.drop.addEventListener("click",function(e){return c(e.target,"select-option")?t.pickOption(e.target):void 0}),this.drop.addEventListener("mousemove",function(e){return c(e.target,"select-option")?t.highlightOption(e.target):void 0}),this.content=document.createElement("div"),l(this.content,"select-content"),this.drop.appendChild(this.content)},e.prototype.open=function(){var t,e,o=this;return l(this.target,"select-open"),this.useNative()?(this.select.style.display="block",setTimeout(function(){var t;return t=document.createEvent("MouseEvents"),t.initEvent("mousedown",!0,!0),o.select.dispatchEvent(t)}),void 0):(l(this.drop,"select-open"),setTimeout(function(){return o.tether.enable()}),(e=this.drop.querySelector(".select-option-selected"))?(this.highlightOption(e),this.scrollDropContentToOption(e),t=function(){var t,i,n;return c(o.drop,"tether-abutted-left")||c(o.drop,"tether-abutted-bottom")?(t=p(o.drop),n=p(e),i=t.top-(n.top+n.height),o.drop.style.top=(parseFloat(o.drop.style.top)||0)+i+"px"):void 0},("always"===this.options.alignToHighlighted||"auto"===this.options.alignToHighlighted&&this.content.scrollHeight<=this.content.clientHeight)&&setTimeout(t),this.trigger("open")):void 0)},e.prototype.close=function(){return g(this.target,"select-open"),this.useNative()?(this.select.style.display="none",void 0):(this.tether.disable(),g(this.drop,"select-open"),this.trigger("close"))},e.prototype.toggle=function(){return this.isOpen()?this.close():this.open()},e.prototype.isOpen=function(){return c(this.drop,"select-open")},e.prototype.bindClick=function(){var t=this;return this.target.addEventListener(h,function(e){return e.preventDefault(),t.toggle()}),document.addEventListener(h,function(e){return!t.isOpen()||e.target===t.drop||t.drop.contains(e.target)||e.target===t.target||t.target.contains(e.target)?void 0:t.close()})},e.prototype.setupTether=function(){return this.tether=new Tether({element:this.drop,target:this.target,attachment:"top left",targetAttachment:"bottom left",classPrefix:"select",constraints:[{to:"window",attachment:"together"}]})},e.prototype.renderTarget=function(){var t,e,o,i;for(this.target.innerHTML="",i=this.select.querySelectorAll("option"),e=0,o=i.length;o>e;e++)if(t=i[e],t.selected){this.target.innerHTML=t.innerHTML;break}return this.target.appendChild(document.createElement("b"))},e.prototype.renderDrop=function(){var t,e,o,i,n,r;for(o=document.createElement("ul"),l(o,"select-options"),r=this.select.querySelectorAll("option"),i=0,n=r.length;n>i;i++)t=r[i],e=document.createElement("li"),l(e,"select-option"),e.setAttribute("data-value",t.value),e.innerHTML=t.innerHTML,t.selected&&l(e,"select-option-selected"),o.appendChild(e);return this.content.innerHTML="",this.content.appendChild(o)},e.prototype.setupSelect=function(){var t=this;return this.select.selectInstance=this,l(this.select,"select-select"),this.select.addEventListener("change",function(){return t.renderDrop(),t.renderTarget()})},e.prototype.findOptionsByPrefix=function(t){var e;return e=this.drop.querySelectorAll(".select-option"),t=t.toLowerCase(),Array.prototype.filter.call(e,function(e){return e.innerHTML.toLowerCase().substr(0,t.length)===t})},e.prototype.findOptionsByValue=function(t){var e;return e=this.drop.querySelectorAll(".select-option"),Array.prototype.filter.call(e,function(e){return e.getAttribute("data-value")===t})},e.prototype.getChosen=function(){return this.isOpen()?this.drop.querySelector(".select-option-highlight"):this.drop.querySelector(".select-option-selected")},e.prototype.selectOption=function(t){return this.isOpen()?(this.highlightOption(t),this.scrollDropContentToOption(t)):this.pickOption(t,!1)},e.prototype.resetSelection=function(){return this.selectOption(this.drop.querySelector(".select-option"))},e.prototype.highlightOption=function(t){var e;return e=this.drop.querySelector(".select-option-highlight"),null!=e&&g(e,"select-option-highlight"),l(t,"select-option-highlight"),this.trigger("highlight",{option:t})},e.prototype.moveHighlight=function(t){var e,o,i,n;return(e=this.drop.querySelector(".select-option-highlight"))?(n=this.drop.querySelectorAll(".select-option"),o=Array.prototype.indexOf.call(n,e),o>=0&&(t===s?o-=1:o+=1,!(0>o||o>=n.length))?(i=n[o],this.highlightOption(i),this.scrollDropContentToOption(i)):void 0):(this.highlightOption(this.drop.querySelector(".select-option")),void 0)},e.prototype.scrollDropContentToOption=function(t){var e,o;return this.content.scrollHeight>this.content.clientHeight?(e=p(this.content),o=p(t),this.content.scrollTop=o.top-(e.top-this.content.scrollTop)):void 0},e.prototype.selectHighlightedOption=function(){return this.pickOption(this.drop.querySelector(".select-option-highlight"))},e.prototype.pickOption=function(t,e){var o=this;return null==e&&(e=!0),this.value=this.select.value=t.getAttribute("data-value"),this.triggerChange(),e?setTimeout(function(){return o.close(),o.target.focus()}):void 0},e.prototype.triggerChange=function(){var t;return t=document.createEvent("HTMLEvents"),t.initEvent("change",!0,!1),this.select.dispatchEvent(t),this.trigger("change",{value:this.select.value})},e.prototype.change=function(t){var e;if(e=this.findOptionsByValue(t),!e.length)throw new Error('Select Error: An option with the value "'+t+"\" doesn't exist");return this.pickOption(e[0],!1)},e}(i),r.init=function(t){var e,o,i,n,s;if(null==t&&(t={}),"loading"===document.readyState)return document.addEventListener("DOMContentLoaded",function(){return r.init(t)}),void 0;for(null==t.selector&&(t.selector="select"),n=document.querySelectorAll(t.selector),s=[],o=0,i=n.length;i>o;o++)e=n[o],e.selectInstance?s.push(void 0):s.push(new r(a({el:e},t)));return s},window.Select=r}.call(this); \ No newline at end of file +(function(){var t,e,o,i,n,r,s,l,h,a,p,u,c,f,d,g,m={}.hasOwnProperty,v=[].indexOf||function(t){for(var e=0,o=this.length;o>e;e++)if(e in this&&this[e]===t)return e;return-1},b=[].slice;null==window.Tether&&(window.Tether={}),a=function(t){var e,o,i,n,r;if(o=getComputedStyle(t).position,"fixed"===o)return t;for(i=void 0,e=t;e=e.parentNode;){try{n=getComputedStyle(e)}catch(s){}if(null==n)return e;if(/(auto|scroll)/.test(n.overflow+n["overflow-y"]+n["overflow-x"])&&("absolute"!==o||"relative"===(r=n.position)||"absolute"===r||"fixed"===r))return e}return document.body},f=function(){var t;return t=0,function(){return t++}}(),g={},h=function(t){var e,i,r,s,l;if(r=t._tetherZeroElement,null==r&&(r=t.createElement("div"),r.setAttribute("data-tether-id",f()),n(r.style,{top:0,left:0,position:"absolute"}),t.body.appendChild(r),t._tetherZeroElement=r),e=r.getAttribute("data-tether-id"),null==g[e]){g[e]={},l=r.getBoundingClientRect();for(i in l)s=l[i],g[e][i]=s;o(function(){return g[e]=void 0})}return g[e]},u=null,s=function(t){var e,o,i,n,r,s,l;t===document?(o=document,t=document.documentElement):o=t.ownerDocument,i=o.documentElement,e={},l=t.getBoundingClientRect();for(n in l)s=l[n],e[n]=s;return r=h(o),e.top-=r.top,e.left-=r.left,null==e.width&&(e.width=document.body.scrollWidth-e.left-e.right),null==e.height&&(e.height=document.body.scrollHeight-e.top-e.bottom),e.top=e.top-i.clientTop,e.left=e.left-i.clientLeft,e.right=o.body.clientWidth-e.width-e.left,e.bottom=o.body.clientHeight-e.height-e.top,e},l=function(t){return t.offsetParent||document.documentElement},n=function(t){var e,o,i,n,r,s,l;for(null==t&&(t={}),e=[],Array.prototype.push.apply(e,arguments),l=e.slice(1),r=0,s=l.length;s>r;r++)if(i=l[r])for(o in i)m.call(i,o)&&(n=i[o],t[o]=n);return t},c=function(t,e){var o,i,n,r,s;if(null!=t.classList){for(r=e.split(" "),s=[],i=0,n=r.length;n>i;i++)o=r[i],s.push(t.classList.remove(o));return s}return t.className=t.className.replace(new RegExp("(^| )"+e.split(" ").join("|")+"( |$)","gi")," ")},e=function(t,e){var o,i,n,r,s;if(null!=t.classList){for(r=e.split(" "),s=[],i=0,n=r.length;n>i;i++)o=r[i],s.push(t.classList.add(o));return s}return c(t,e),t.className+=" "+e},p=function(t,e){return null!=t.classList?t.classList.contains(e):new RegExp("(^| )"+e+"( |$)","gi").test(t.className)},d=function(t,o,i){var n,r,s,l,h,a;for(r=0,l=i.length;l>r;r++)n=i[r],v.call(o,n)<0&&p(t,n)&&c(t,n);for(a=[],s=0,h=o.length;h>s;s++)n=o[s],a.push(p(t,n)?void 0:e(t,n));return a},i=[],o=function(t){return i.push(t)},r=function(){var t,e;for(e=[];t=i.pop();)e.push(t());return e},t=function(){function t(){}return t.prototype.on=function(t,e,o,i){var n;return null==i&&(i=!1),null==this.bindings&&(this.bindings={}),null==(n=this.bindings)[t]&&(n[t]=[]),this.bindings[t].push({handler:e,ctx:o,once:i})},t.prototype.once=function(t,e,o){return this.on(t,e,o,!0)},t.prototype.off=function(t,e){var o,i,n;if(null!=(null!=(i=this.bindings)?i[t]:void 0)){if(null==e)return delete this.bindings[t];for(o=0,n=[];o=e&&e>=t-o},O=function(){var t,e,o,i,n;for(t=document.createElement("div"),n=["transform","webkitTransform","OTransform","MozTransform","msTransform"],o=0,i=n.length;i>o;o++)if(e=n[o],void 0!==t.style[e])return e}(),w=[],y=function(){var t,e,o;for(e=0,o=w.length;o>e;e++)t=w[e],t.position(!1);return a()},g=function(){var t;return null!=(t="undefined"!=typeof performance&&null!==performance?"function"==typeof performance.now?performance.now():void 0:void 0)?t:+new Date},function(){var t,e,o,i,n,r,s,l,h;for(e=null,o=null,i=null,n=function(){if(null!=o&&o>16)return o=Math.min(o-16,250),void(i=setTimeout(n,250));if(!(null!=e&&g()-e<10))return null!=i&&(clearTimeout(i),i=null),e=g(),y(),o=g()-e},l=["resize","scroll","touchmove"],h=[],r=0,s=l.length;s>r;r++)t=l[r],h.push(window.addEventListener(t,n));return h}(),t={center:"center",left:"right",right:"left"},e={middle:"middle",top:"bottom",bottom:"top"},o={top:0,left:0,middle:"50%",center:"50%",bottom:"100%",right:"100%"},s=function(o,i){var n,r;return n=o.left,r=o.top,"auto"===n&&(n=t[i.left]),"auto"===r&&(r=e[i.top]),{left:n,top:r}},r=function(t){var e,i;return{left:null!=(e=o[t.left])?e:t.left,top:null!=(i=o[t.top])?i:t.top}},n=function(){var t,e,o,i,n,r,s;for(e=1<=arguments.length?x.call(arguments,0):[],o={top:0,left:0},n=0,r=e.length;r>n;n++)s=e[n],i=s.top,t=s.left,"string"==typeof i&&(i=parseFloat(i,10)),"string"==typeof t&&(t=parseFloat(t,10)),o.top+=i,o.left+=t;return o},m=function(t,e){return"string"==typeof t.left&&-1!==t.left.indexOf("%")&&(t.left=parseFloat(t.left,10)/100*e.width),"string"==typeof t.top&&-1!==t.top.indexOf("%")&&(t.top=parseFloat(t.top,10)/100*e.height),t},v=b=function(t){var e,o,i;return i=t.split(" "),o=i[0],e=i[1],{top:o,left:e}},S=function(){function t(t){this.position=L(this.position,this);var e,o,i,n,r;for(w.push(this),this.history=[],this.setOptions(t,!1),n=Tether.modules,o=0,i=n.length;i>o;o++)e=n[o],null!=(r=e.initialize)&&r.call(this);this.position()}return t.modules=[],t.prototype.getClass=function(t){var e,o;return(null!=(e=this.options.classes)?e[t]:void 0)?this.options.classes[t]:(null!=(o=this.options.classes)?o[t]:void 0)!==!1?this.options.classPrefix?""+this.options.classPrefix+"-"+t:t:""},t.prototype.setOptions=function(t,e){var o,n,r,s,l,a;for(this.options=t,null==e&&(e=!0),o={offset:"0 0",targetOffset:"0 0",targetAttachment:"auto auto",classPrefix:"tether"},this.options=h(o,this.options),l=this.options,this.element=l.element,this.target=l.target,this.targetModifier=l.targetModifier,"viewport"===this.target?(this.target=document.body,this.targetModifier="visible"):"scroll-handle"===this.target&&(this.target=document.body,this.targetModifier="scroll-handle"),a=["element","target"],r=0,s=a.length;s>r;r++){if(n=a[r],null==this[n])throw new Error("Tether Error: Both element and target must be defined");null!=this[n].jquery?this[n]=this[n][0]:"string"==typeof this[n]&&(this[n]=document.querySelector(this[n]))}if(i(this.element,this.getClass("element")),i(this.target,this.getClass("target")),!this.options.attachment)throw new Error("Tether Error: You must provide an attachment");return this.targetAttachment=v(this.options.targetAttachment),this.attachment=v(this.options.attachment),this.offset=b(this.options.offset),this.targetOffset=b(this.options.targetOffset),null!=this.scrollParent&&this.disable(),this.scrollParent="scroll-handle"===this.targetModifier?this.target:f(this.target),this.options.enabled!==!1?this.enable(e):void 0},t.prototype.getTargetBounds=function(){var t,e,o,i,n,r,s,l,h;if(null==this.targetModifier)return p(this.target);switch(this.targetModifier){case"visible":return this.target===document.body?{top:pageYOffset,left:pageXOffset,height:innerHeight,width:innerWidth}:(t=p(this.target),n={height:t.height,width:t.width,top:t.top,left:t.left},n.height=Math.min(n.height,t.height-(pageYOffset-t.top)),n.height=Math.min(n.height,t.height-(t.top+t.height-(pageYOffset+innerHeight))),n.height=Math.min(innerHeight,n.height),n.height-=2,n.width=Math.min(n.width,t.width-(pageXOffset-t.left)),n.width=Math.min(n.width,t.width-(t.left+t.width-(pageXOffset+innerWidth))),n.width=Math.min(innerWidth,n.width),n.width-=2,n.toph.clientWidth||"scroll"===[l.overflow,l.overflowX]||this.target!==document.body,r=0,o&&(r=15),i=t.height-parseFloat(l.borderTopWidth)-parseFloat(l.borderBottomWidth)-r,n={width:15,height:.975*i*(i/h.scrollHeight),left:t.left+t.width-parseFloat(l.borderLeftWidth)-15},e=0,408>i&&this.target===document.body&&(e=-11e-5*Math.pow(i,2)-.00727*i+22.58),this.target!==document.body&&(n.height=Math.max(n.height,24)),s=this.target.scrollTop/(h.scrollHeight-i),n.top=s*(i-n.height-e)+t.top+parseFloat(l.borderTopWidth),this.target===document.body&&(n.height=Math.max(n.height,24)),n}},t.prototype.clearCache=function(){return this._cache={}},t.prototype.cache=function(t,e){return null==this._cache&&(this._cache={}),null==this._cache[t]&&(this._cache[t]=e.call(this)),this._cache[t]},t.prototype.enable=function(t){return null==t&&(t=!0),i(this.target,this.getClass("enabled")),i(this.element,this.getClass("enabled")),this.enabled=!0,this.scrollParent!==document&&this.scrollParent.addEventListener("scroll",this.position),t?this.position():void 0},t.prototype.disable=function(){return C(this.target,this.getClass("enabled")),C(this.element,this.getClass("enabled")),this.enabled=!1,null!=this.scrollParent?this.scrollParent.removeEventListener("scroll",this.position):void 0},t.prototype.destroy=function(){var t,e,o,i,n;for(this.disable(),n=[],t=o=0,i=w.length;i>o;t=++o){if(e=w[t],e===this){w.splice(t,1);break}n.push(void 0)}return n},t.prototype.updateAttachClasses=function(t,e){var o,i,n,r,s,h,a,p,u,c=this;for(null==t&&(t=this.attachment),null==e&&(e=this.targetAttachment),r=["left","top","bottom","right","middle","center"],(null!=(u=this._addAttachClasses)?u.length:void 0)&&this._addAttachClasses.splice(0,this._addAttachClasses.length),o=null!=this._addAttachClasses?this._addAttachClasses:this._addAttachClasses=[],t.top&&o.push(""+this.getClass("element-attached")+"-"+t.top),t.left&&o.push(""+this.getClass("element-attached")+"-"+t.left),e.top&&o.push(""+this.getClass("target-attached")+"-"+e.top),e.left&&o.push(""+this.getClass("target-attached")+"-"+e.left),i=[],s=0,a=r.length;a>s;s++)n=r[s],i.push(""+this.getClass("element-attached")+"-"+n);for(h=0,p=r.length;p>h;h++)n=r[h],i.push(""+this.getClass("target-attached")+"-"+n);return l(function(){return null!=c._addAttachClasses?(T(c.element,c._addAttachClasses,i),T(c.target,c._addAttachClasses,i),c._addAttachClasses=void 0):void 0})},t.prototype.position=function(t){var e,o,i,l,h,c,f,d,g,v,b,y,C,w,O,T,E,S,A,x,L,H,M,B,P,k,N,_,W,q,D,F,z=this;if(null==t&&(t=!0),this.enabled){for(this.clearCache(),A=s(this.targetAttachment,this.attachment),this.updateAttachClasses(this.attachment,A),e=this.cache("element-bounds",function(){return p(z.element)}),B=e.width,i=e.height,0===B&&0===i&&null!=this.lastSize?(W=this.lastSize,B=W.width,i=W.height):this.lastSize={width:B,height:i},H=L=this.cache("target-bounds",function(){return z.getTargetBounds()}),g=m(r(this.attachment),{width:B,height:i}),x=m(r(A),H),h=m(this.offset,{width:B,height:i}),c=m(this.targetOffset,H),g=n(g,h),x=n(x,c),l=L.left+x.left-g.left,M=L.top+x.top-g.top,q=Tether.modules,P=0,N=q.length;N>P;P++)if(f=q[P],O=f.position.call(this,{left:l,top:M,targetAttachment:A,targetPos:L,elementPos:e,offset:g,targetOffset:x,manualOffset:h,manualTargetOffset:c}),null!=O&&"object"==typeof O){if(O===!1)return!1;M=O.top,l=O.left}if(d={page:{top:M,bottom:document.body.scrollHeight-M-i,left:l,right:document.body.scrollWidth-l-B},viewport:{top:M-pageYOffset,bottom:pageYOffset-M-i+innerHeight,left:l-pageXOffset,right:pageXOffset-l-B+innerWidth}},(null!=(D=this.options.optimizations)?D.moveElement:void 0)!==!1&&null==this.targetModifier){for(b=this.cache("target-offsetparent",function(){return u(z.target)}),w=this.cache("target-offsetparent-bounds",function(){return p(b)}),C=getComputedStyle(b),o=getComputedStyle(this.element),y=w,v={},F=["Top","Left","Bottom","Right"],k=0,_=F.length;_>k;k++)S=F[k],v[S.toLowerCase()]=parseFloat(C["border"+S+"Width"]);w.right=document.body.scrollWidth-w.left-y.width+v.right,w.bottom=document.body.scrollHeight-w.top-y.height+v.bottom,d.page.top>=w.top+v.top&&d.page.bottom>=w.bottom&&d.page.left>=w.left+v.left&&d.page.right>=w.right&&(E=b.scrollTop,T=b.scrollLeft,d.offset={top:d.page.top-w.top+E-v.top,left:d.page.left-w.left+T-v.left})}return this.move(d),this.history.unshift(d),this.history.length>3&&this.history.pop(),t&&a(),!0}},t.prototype.move=function(t){var e,o,i,n,r,s,a,p,c,f,d,g,m,v,b,y,C,w=this;if(null!=this.element.parentNode){p={};for(f in t){p[f]={};for(n in t[f]){for(i=!1,y=this.history,v=0,b=y.length;b>v;v++)if(a=y[v],!E(null!=(C=a[f])?C[n]:void 0,t[f][n])){i=!0;break}i||(p[f][n]=!0)}}e={top:"",left:"",right:"",bottom:""},c=function(t,o){var i,n,r;return(null!=(r=w.options.optimizations)?r.gpu:void 0)===!1?(t.top?e.top=""+o.top+"px":e.bottom=""+o.bottom+"px",t.left?e.left=""+o.left+"px":e.right=""+o.right+"px"):(t.top?(e.top=0,n=o.top):(e.bottom=0,n=-o.bottom),t.left?(e.left=0,i=o.left):(e.right=0,i=-o.right),e[O]="translateX("+Math.round(i)+"px) translateY("+Math.round(n)+"px)","msTransform"!==O?e[O]+=" translateZ(0)":void 0)},r=!1,(p.page.top||p.page.bottom)&&(p.page.left||p.page.right)?(e.position="absolute",c(p.page,t.page)):(p.viewport.top||p.viewport.bottom)&&(p.viewport.left||p.viewport.right)?(e.position="fixed",c(p.viewport,t.viewport)):null!=p.offset&&p.offset.top&&p.offset.left?(e.position="absolute",s=this.cache("target-offsetparent",function(){return u(w.target)}),u(this.element)!==s&&l(function(){return w.element.parentNode.removeChild(w.element),s.appendChild(w.element)}),c(p.offset,t.offset),r=!0):(e.position="absolute",c({top:!0,left:!0},t.page)),r||"BODY"===this.element.parentNode.tagName||(this.element.parentNode.removeChild(this.element),document.body.appendChild(this.element)),m={},g=!1;for(n in e)d=e[n],o=this.element.style[n],""===o||""===d||"top"!==n&&"left"!==n&&"bottom"!==n&&"right"!==n||(o=parseFloat(o),d=parseFloat(d)),o!==d&&(g=!0,m[n]=e[n]);return g?l(function(){return h(w.element.style,m)}):void 0}},t}(),Tether.position=y,window.Tether=h(S,Tether)}.call(this),function(){var t,e,o,i,n,r,s,l,h,a,p=[].indexOf||function(t){for(var e=0,o=this.length;o>e;e++)if(e in this&&this[e]===t)return e;return-1};a=Tether.Utils,s=a.getOuterSize,r=a.getBounds,l=a.getSize,i=a.extend,h=a.updateClasses,o=a.defer,e={left:"right",right:"left",top:"bottom",bottom:"top",middle:"middle"},t=["left","top","right","bottom"],n=function(e,o){var i,n,s,l,h,a,p;if("scrollParent"===o?o=e.scrollParent:"window"===o&&(o=[pageXOffset,pageYOffset,innerWidth+pageXOffset,innerHeight+pageYOffset]),o===document&&(o=o.documentElement),null!=o.nodeType)for(n=l=r(o),h=getComputedStyle(o),o=[n.left,n.top,l.width+n.left,l.height+n.top],i=a=0,p=t.length;p>a;i=++a)s=t[i],s=s[0].toUpperCase()+s.substr(1),"Top"===s||"Left"===s?o[i]+=parseFloat(h["border"+s+"Width"]):o[i]-=parseFloat(h["border"+s+"Width"]);return o},Tether.modules.push({position:function(e){var s,l,a,u,c,f,d,g,m,v,b,y,C,w,O,T,E,S,A,x,L,H,M,B,P,k,N,_,W,q,D,F,z,Y,X,j,I,U,R,Z,V,$,G,J,K,Q,te,ee=this;if(k=e.top,b=e.left,L=e.targetAttachment,!this.options.constraints)return!0;for(S=function(e){var o,i,n,r;for(ee.removeClass(e),r=[],i=0,n=t.length;n>i;i++)o=t[i],r.push(ee.removeClass(""+e+"-"+o));return r},Z=this.cache("element-bounds",function(){return r(ee.element)}),v=Z.height,N=Z.width,0===N&&0===v&&null!=this.lastSize&&(V=this.lastSize,N=V.width,v=V.height),M=this.cache("target-bounds",function(){return ee.getTargetBounds()}),H=M.height,B=M.width,x={},m={},l=[this.getClass("pinned"),this.getClass("out-of-bounds")],$=this.options.constraints,_=0,F=$.length;F>_;_++)g=$[_],g.outOfBoundsClass&&l.push(g.outOfBoundsClass),g.pinnedClass&&l.push(g.pinnedClass);for(W=0,z=l.length;z>W;W++)for(d=l[W],G=["left","top","right","bottom"],q=0,Y=G.length;Y>q;q++)A=G[q],l.push(""+d+"-"+A);for(s=[],x=i({},L),m=i({},this.attachment),J=this.options.constraints,D=0,X=J.length;X>D;D++){if(g=J[D],P=g.to,a=g.attachment,O=g.pin,null==a&&(a=""),p.call(a," ")>=0?(K=a.split(" "),f=K[0],c=K[1]):c=f=a,u=n(this,P),("target"===f||"both"===f)&&(ku[3]&&"bottom"===x.top&&(k-=H,x.top="top")),"together"===f&&(ku[3]&&"bottom"===x.top&&("top"===m.top?(k-=H,x.top="top",k-=v,m.top="bottom"):"bottom"===m.top&&(k-=H,x.top="top",k+=v,m.top="top"))),("target"===c||"both"===c)&&(bu[2]&&"right"===x.left&&(b-=B,x.left="left")),"together"===c&&(bu[2]&&"right"===x.left&&("left"===m.left?(b-=B,x.left="left",b-=N,m.left="right"):"right"===m.left&&(b-=B,x.left="left",b+=N,m.left="left"))),("element"===f||"both"===f)&&(ku[3]&&"top"===m.top&&(k-=v,m.top="bottom")),("element"===c||"both"===c)&&(bu[2]&&"left"===m.left&&(b-=N,m.left="right")),"string"==typeof O?O=function(){var t,e,o,i;for(o=O.split(","),i=[],e=0,t=o.length;t>e;e++)w=o[e],i.push(w.trim());return i}():O===!0&&(O=["top","left","right","bottom"]),O||(O=[]),T=[],y=[],k=0?(k=u[1],T.push("top")):y.push("top")),k+v>u[3]&&(p.call(O,"bottom")>=0?(k=u[3]-v,T.push("bottom")):y.push("bottom")),b=0?(b=u[0],T.push("left")):y.push("left")),b+N>u[2]&&(p.call(O,"right")>=0?(b=u[2]-N,T.push("right")):y.push("right")),T.length)for(E=null!=(Q=this.options.pinnedClass)?Q:this.getClass("pinned"),s.push(E),U=0,j=T.length;j>U;U++)A=T[U],s.push(""+E+"-"+A);if(y.length)for(C=null!=(te=this.options.outOfBoundsClass)?te:this.getClass("out-of-bounds"),s.push(C),R=0,I=y.length;I>R;R++)A=y[R],s.push(""+C+"-"+A);(p.call(T,"left")>=0||p.call(T,"right")>=0)&&(m.left=x.left=!1),(p.call(T,"top")>=0||p.call(T,"bottom")>=0)&&(m.top=x.top=!1),(x.top!==L.top||x.left!==L.left||m.top!==this.attachment.top||m.left!==this.attachment.left)&&this.updateAttachClasses(m,x)}return o(function(){return h(ee.target,s,l),h(ee.element,s,l)}),{top:k,left:b}}})}.call(this),function(){var t,e,o,i;i=Tether.Utils,e=i.getBounds,o=i.updateClasses,t=i.defer,Tether.modules.push({position:function(i){var n,r,s,l,h,a,p,u,c,f,d,g,m,v,b,y,C,w,O,T,E,S,A,x,L,H=this;if(d=i.top,a=i.left,E=this.cache("element-bounds",function(){return e(H.element)}),h=E.height,g=E.width,f=this.getTargetBounds(),l=d+h,p=a+g,n=[],d<=f.bottom&&l>=f.top)for(S=["left","right"],m=0,C=S.length;C>m;m++)u=S[m],((A=f[u])===a||A===p)&&n.push(u);if(a<=f.right&&p>=f.left)for(x=["top","bottom"],v=0,w=x.length;w>v;v++)u=x[v],((L=f[u])===d||L===l)&&n.push(u);for(s=[],r=[],c=["left","top","right","bottom"],s.push(this.getClass("abutted")),b=0,O=c.length;O>b;b++)u=c[b],s.push(""+this.getClass("abutted")+"-"+u);for(n.length&&r.push(this.getClass("abutted")),y=0,T=n.length;T>y;y++)u=n[y],r.push(""+this.getClass("abutted")+"-"+u);return t(function(){return o(H.target,r,s),o(H.element,r,s)}),!0}})}.call(this),function(){Tether.modules.push({position:function(t){var e,o,i,n,r,s,l;return s=t.top,e=t.left,this.options.shift?(o=function(t){return"function"==typeof t?t.call(this,{top:s,left:e}):t},i=o(this.options.shift),"string"==typeof i?(i=i.split(" "),i[1]||(i[1]=i[0]),r=i[0],n=i[1],r=parseFloat(r,10),n=parseFloat(n,10)):(l=[i.top,i.left],r=l[0],n=l[1]),s+=r,e+=n,{top:s,left:e}):void 0}})}.call(this),function(){var t,e,o,i,n,r,s,l,h,a,p,u,c,f,d,g,m,v,b,y,C,w={}.hasOwnProperty,O=function(t,e){function o(){this.constructor=t}for(var i in e)w.call(e,i)&&(t[i]=e[i]);return o.prototype=e.prototype,t.prototype=new o,t.__super__=e.prototype,t};C=Tether.Utils,a=C.extend,l=C.addClass,g=C.removeClass,c=C.hasClass,p=C.getBounds,i=C.Evented,e=13,o=27,n=32,s=38,t=40,b="ontouchstart"in document.documentElement,h=b?"touchstart":"click",y=function(){return b&&(640>=innerWidth||640>=innerHeight)},f=function(t){return Array.prototype.reduce.call(t,function(t,e){return t===e?e:!1})},u=function(){var t;return null!=(t=document.querySelector(".select-target-focused"))?t.selectInstance:void 0},m="",v=void 0,d=void 0,document.addEventListener("keypress",function(t){var e,o,i,r;if((i=u())&&0!==t.charCode)return t.keyCode===n&&t.preventDefault(),clearTimeout(v),v=setTimeout(function(){return m=""},500),m+=String.fromCharCode(t.charCode),e=i.findOptionsByPrefix(m),1===e.length?void i.selectOption(e[0]):m.length>1&&f(m)&&(o=i.findOptionsByPrefix(m[0]),o.length)?(r=o.indexOf(i.getChosen()),r+=1,r%=o.length,void i.selectOption(o[r])):void(e.length&&i.selectOption(e[0]))}),document.addEventListener("keydown",function(i){var r,l,h;if(r=u())if(((l=i.keyCode)===s||l===t||l===o)&&i.preventDefault(),r.isOpen())switch(i.keyCode){case s:case t:return r.moveHighlight(i.keyCode);case e:return r.selectHighlightedOption();case o:return r.close(),r.target.focus()}else if((h=i.keyCode)===s||h===t||h===n)return r.open()}),r=function(t){function e(t){if(this.options=t,this.options=a({},e.defaults,this.options),this.select=this.options.el,null!=this.select.selectInstance)throw new Error("This element has already been turned into a Select");this.setupTarget(),this.renderTarget(),this.setupDrop(),this.renderDrop(),this.setupSelect(),this.setupTether(),this.bindClick(),this.value=this.select.value}return O(e,t),e.defaults={alignToHighlighed:"auto",className:"select-theme-default"},e.prototype.useNative=function(){return this.options.useNative===!0||y()&&this.options.useNative!==!1},e.prototype.setupTarget=function(){var t,e=this;return this.target=document.createElement("a"),this.target.href="javascript:;",l(this.target,"select-target"),t=this.select.getAttribute("tabindex")||0,this.target.setAttribute("tabindex",t),this.options.className&&l(this.target,this.options.className),this.target.selectInstance=this,this.target.addEventListener("click",function(){return e.isOpen()?e.target.blur():e.target.focus()}),this.target.addEventListener("focus",function(){return l(e.target,"select-target-focused")}),this.target.addEventListener("blur",function(t){return e.isOpen()&&t.relatedTarget&&!e.drop.contains(t.relatedTarget)&&e.close(),g(e.target,"select-target-focused")}),this.select.parentNode.insertBefore(this.target,this.select.nextSibling)},e.prototype.setupDrop=function(){var t=this;return this.drop=document.createElement("div"),l(this.drop,"select"),this.options.className&&l(this.drop,this.options.className),document.body.appendChild(this.drop),this.drop.addEventListener("click",function(e){return c(e.target,"select-option")?t.pickOption(e.target):void 0}),this.drop.addEventListener("mousemove",function(e){return c(e.target,"select-option")?t.highlightOption(e.target):void 0}),this.content=document.createElement("div"),l(this.content,"select-content"),this.drop.appendChild(this.content)},e.prototype.open=function(){var t,e,o=this;return l(this.target,"select-open"),this.useNative()?(this.select.style.display="block",void setTimeout(function(){var t;return t=document.createEvent("MouseEvents"),t.initEvent("mousedown",!0,!0),o.select.dispatchEvent(t)})):(l(this.drop,"select-open"),setTimeout(function(){return o.tether.enable()}),(e=this.drop.querySelector(".select-option-selected"))?(this.highlightOption(e),this.scrollDropContentToOption(e),t=function(){var t,i,n;return c(o.drop,"tether-abutted-left")||c(o.drop,"tether-abutted-bottom")?(t=p(o.drop),n=p(e),i=t.top-(n.top+n.height),o.drop.style.top=(parseFloat(o.drop.style.top)||0)+i+"px"):void 0},("always"===this.options.alignToHighlighted||"auto"===this.options.alignToHighlighted&&this.content.scrollHeight<=this.content.clientHeight)&&setTimeout(t),this.trigger("open")):void 0)},e.prototype.close=function(){return g(this.target,"select-open"),this.useNative()?void(this.select.style.display="none"):(this.tether.disable(),g(this.drop,"select-open"),this.trigger("close"))},e.prototype.toggle=function(){return this.isOpen()?this.close():this.open()},e.prototype.isOpen=function(){return c(this.drop,"select-open")},e.prototype.bindClick=function(){var t=this;return this.target.addEventListener(h,function(e){return e.preventDefault(),t.toggle()}),document.addEventListener(h,function(e){return!t.isOpen()||e.target===t.drop||t.drop.contains(e.target)||e.target===t.target||t.target.contains(e.target)?void 0:t.close()})},e.prototype.setupTether=function(){return this.tether=new Tether({element:this.drop,target:this.target,attachment:"top left",targetAttachment:"bottom left",classPrefix:"select",constraints:[{to:"window",attachment:"together"}]})},e.prototype.renderTarget=function(){var t,e,o,i;for(this.target.innerHTML="",i=this.select.querySelectorAll("option"),e=0,o=i.length;o>e;e++)if(t=i[e],t.selected){this.target.innerHTML=t.innerHTML;break}return this.target.appendChild(document.createElement("b"))},e.prototype.renderDrop=function(){var t,e,o,i,n,r;for(o=document.createElement("ul"),l(o,"select-options"),r=this.select.querySelectorAll("option"),i=0,n=r.length;n>i;i++)t=r[i],e=document.createElement("li"),l(e,"select-option"),e.setAttribute("data-value",t.value),e.innerHTML=t.innerHTML,t.selected&&l(e,"select-option-selected"),o.appendChild(e);return this.content.innerHTML="",this.content.appendChild(o)},e.prototype.setupSelect=function(){var t=this;return this.select.selectInstance=this,this.useNative()?l(this.select,"select-select-native"):l(this.select,"select-select"),this.select.addEventListener("change",function(){return t.renderDrop(),t.renderTarget()})},e.prototype.findOptionsByPrefix=function(t){var e;return e=this.drop.querySelectorAll(".select-option"),t=t.toLowerCase(),Array.prototype.filter.call(e,function(e){return e.innerHTML.toLowerCase().substr(0,t.length)===t})},e.prototype.findOptionsByValue=function(t){var e;return e=this.drop.querySelectorAll(".select-option"),Array.prototype.filter.call(e,function(e){return e.getAttribute("data-value")===t})},e.prototype.getChosen=function(){return this.drop.querySelector(this.isOpen()?".select-option-highlight":".select-option-selected")},e.prototype.selectOption=function(t){return this.isOpen()?(this.highlightOption(t),this.scrollDropContentToOption(t)):this.pickOption(t,!1)},e.prototype.resetSelection=function(){return this.selectOption(this.drop.querySelector(".select-option"))},e.prototype.highlightOption=function(t){var e;return e=this.drop.querySelector(".select-option-highlight"),null!=e&&g(e,"select-option-highlight"),l(t,"select-option-highlight"),this.trigger("highlight",{option:t})},e.prototype.moveHighlight=function(t){var e,o,i,n;return(e=this.drop.querySelector(".select-option-highlight"))?(n=this.drop.querySelectorAll(".select-option"),o=Array.prototype.indexOf.call(n,e),o>=0&&(t===s?o-=1:o+=1,!(0>o||o>=n.length))?(i=n[o],this.highlightOption(i),this.scrollDropContentToOption(i)):void 0):void this.highlightOption(this.drop.querySelector(".select-option"))},e.prototype.scrollDropContentToOption=function(t){var e,o;return this.content.scrollHeight>this.content.clientHeight?(e=p(this.content),o=p(t),this.content.scrollTop=o.top-(e.top-this.content.scrollTop)):void 0},e.prototype.selectHighlightedOption=function(){return this.pickOption(this.drop.querySelector(".select-option-highlight"))},e.prototype.pickOption=function(t,e){var o=this;return null==e&&(e=!0),this.value=this.select.value=t.getAttribute("data-value"),this.triggerChange(),e?setTimeout(function(){return o.close(),o.target.focus()}):void 0},e.prototype.triggerChange=function(){var t;return t=document.createEvent("HTMLEvents"),t.initEvent("change",!0,!1),this.select.dispatchEvent(t),this.trigger("change",{value:this.select.value})},e.prototype.change=function(t){var e;if(e=this.findOptionsByValue(t),!e.length)throw new Error('Select Error: An option with the value "'+t+"\" doesn't exist");return this.pickOption(e[0],!1)},e}(i),r.init=function(t){var e,o,i,n,s;if(null==t&&(t={}),"loading"===document.readyState)return void document.addEventListener("DOMContentLoaded",function(){return r.init(t)});for(null==t.selector&&(t.selector="select"),n=document.querySelectorAll(t.selector),s=[],o=0,i=n.length;i>o;o++)e=n[o],s.push(e.selectInstance?void 0:new r(a({el:e},t)));return s},window.Select=r}.call(this); \ No newline at end of file From b5a2f30ae0c1851cd2180b8e3c9715259784dad2 Mon Sep 17 00:00:00 2001 From: Trevor Burnham Date: Thu, 6 Feb 2014 17:57:37 -0500 Subject: [PATCH 2/2] If useNative enabled, restrict tabbing to the native element Prevents tabbing through both elements, e.g. on iOS devices with tabbing enabled for all elements through accessibility settings. --- coffee/select.coffee | 8 ++++++-- js/select.js | 8 ++++++-- select.js | 8 ++++++-- select.min.js | 2 +- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/coffee/select.coffee b/coffee/select.coffee index a1b72d2..383d906 100644 --- a/coffee/select.coffee +++ b/coffee/select.coffee @@ -123,8 +123,12 @@ class Select extends Evented addClass @target, 'select-target' - tabIndex = @select.getAttribute('tabindex') or 0 - @target.setAttribute 'tabindex', tabIndex + if @useNative() + # Only allow tabbing on the native