Use an etemplate / top template level prefix to avoid DOM ID collisions

This commit is contained in:
Nathan Gray 2013-07-17 13:08:48 +00:00
parent 792f1b26cc
commit 1b270b2d6f
6 changed files with 12 additions and 8 deletions

View File

@ -292,7 +292,7 @@ var et2_DOMWidget = et2_widget.extend(et2_IDOMNode,
{
if (_value != "")
{
node.setAttribute("id", _value);
node.setAttribute("id", this.getInstanceManager().uniqueId+'_'+this.id);
}
else
{

View File

@ -148,9 +148,10 @@ var et2_inputWidget = et2_valueWidget.extend([et2_IInput,et2_ISubmitListener],
var node = this.getInputNode();
if (node)
{
// Unique ID to prevent DOM collisions across multiple templates
if (_value != "")
{
node.setAttribute("id", _value);
node.setAttribute("id", this.getInstanceManager().uniqueId+'_'+this.id);
node.setAttribute("name", _value);
}
else

View File

@ -344,7 +344,7 @@ var et2_date_duration = et2_date.extend(
{
if (_value != "")
{
node.setAttribute("id", _value);
node.setAttribute("id", this.getInstanceManager().uniqueId+'_'+this.id);
}
else
{

View File

@ -225,7 +225,6 @@ var et2_dialog = et2_widget.extend({
}
this.div = $j(document.createElement("div"));
this.div.attr("id", this.id);
this._createDialog();
},

View File

@ -212,9 +212,9 @@ var et2_dropdown_button = et2_inputWidget.extend(
// Update internal IDs - not really needed since we refer by internal
// javascript reference, but good to keep up to date
this.internal_ids = {
div: this.id + "_wrapper",
button: this.id,
menu: this.id + "_menu"
div: this.getInstanceManager().uniqueId+'_'+this.id + "_wrapper",
button: this.getInstanceManager().uniqueId+'_'+this.id,
menu: this.getInstanceManager().uniqueId+'_'+this.id + "_menu"
};
for(var key in this.internal_ids)
{

View File

@ -138,6 +138,10 @@ var et2_selectbox = et2_inputWidget.extend(
},
destroy: function() {
if(this.input != null)
{
this.input.unchosen();
}
this._super.apply(this, arguments);
this.input = null;
@ -275,7 +279,7 @@ var et2_selectbox = et2_inputWidget.extend(
// Already in header
if(_label == this.options.empty_label) return;
var opt_id = this.id + "_opt_" + _value;
var opt_id = this.getInstanceManager().uniqueId+'_'+ this.id + "_opt_" + _value;
var label = jQuery(document.createElement("label"))
.attr("for", opt_id)
.hover(