Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
34
gaia/shared/elements/gaia_select/script.js
Executable file
34
gaia/shared/elements/gaia_select/script.js
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
'use strict';
|
||||
/* global ComponentUtils */
|
||||
|
||||
window.GaiaSelect = (function(win) {
|
||||
// Extend from the HTMLSelectElement prototype
|
||||
var proto = Object.create(HTMLElement.prototype);
|
||||
|
||||
// Allow baseurl to be overridden (used for demo page)
|
||||
var baseurl = window.GaiaSelectBaseurl || '/shared/elements/gaia_select/';
|
||||
|
||||
var selectCounter = 0;
|
||||
|
||||
proto.createdCallback = function() {
|
||||
var label = this.querySelector('label');
|
||||
if (label) {
|
||||
// If we have a label, make sure it correctly associated
|
||||
var select = this.querySelector('select');
|
||||
if (label.control != select) {
|
||||
// If it not associated, do so.
|
||||
var id = select.id;
|
||||
if (!id) {
|
||||
// If the select does not already have an id, create one.
|
||||
select.id = id = 'gaia-select-' + (++selectCounter);
|
||||
}
|
||||
label.htmlFor = id;
|
||||
}
|
||||
}
|
||||
|
||||
ComponentUtils.style.call(this, baseurl);
|
||||
};
|
||||
|
||||
// Register and return the constructor
|
||||
return document.registerElement('gaia-select', { prototype: proto });
|
||||
})(window);
|
||||
Loading…
Reference in a new issue