fixing bugs
This commit is contained in:
@@ -42,7 +42,7 @@ web2d.Element.prototype._initialize = function(attributes)
|
||||
{
|
||||
var funcName = this._attributeNameToFuncName(key, 'set');
|
||||
var funcArgs = batchExecute[funcName];
|
||||
if (!funcArgs)
|
||||
if (!core.Utils.isDefined(funcArgs))
|
||||
{
|
||||
funcArgs = [];
|
||||
}
|
||||
@@ -63,7 +63,7 @@ web2d.Element.prototype._initialize = function(attributes)
|
||||
for (var key in batchExecute)
|
||||
{
|
||||
var func = this[key];
|
||||
if (!func)
|
||||
if (!core.Utils.isDefined(func))
|
||||
{
|
||||
throw "Could not find function: " + key;
|
||||
}
|
||||
@@ -223,7 +223,7 @@ web2d.Element.prototype._propertyNameToSignature =
|
||||
web2d.Element.prototype._attributeNameToFuncName = function(attributeKey, prefix)
|
||||
{
|
||||
var signature = this._propertyNameToSignature[attributeKey];
|
||||
if (!signature)
|
||||
if (!core.Utils.isDefined(signature))
|
||||
{
|
||||
throw "Unsupported attribute: " + attributeKey;
|
||||
}
|
||||
@@ -292,13 +292,13 @@ web2d.Element.prototype.getAttribute = function(key)
|
||||
|
||||
var getterResult = getter.apply(this, []);
|
||||
var attibuteName = signature[2];
|
||||
if (!attibuteName)
|
||||
if (!core.Utils.isDefined(attibuteName))
|
||||
{
|
||||
throw "Could not find attribute mapping for:" + key;
|
||||
}
|
||||
|
||||
var result = getterResult[attibuteName];
|
||||
if (!result)
|
||||
if (!core.Utils.isDefined(result))
|
||||
{
|
||||
throw "Could not find attribute with name:" + attibuteName;
|
||||
}
|
||||
|
@@ -35,7 +35,7 @@ web2d.EventDispatcher = function(element)
|
||||
|
||||
web2d.EventDispatcher.prototype.addListener = function(type, listener)
|
||||
{
|
||||
if (!listener)
|
||||
if (!core.Utils.isDefined(listener))
|
||||
{
|
||||
throw "Listener can not be null.";
|
||||
}
|
||||
@@ -44,7 +44,7 @@ web2d.EventDispatcher.prototype.addListener = function(type, listener)
|
||||
|
||||
web2d.EventDispatcher.prototype.removeListener = function(type, listener)
|
||||
{
|
||||
if (!listener)
|
||||
if (!core.Utils.isDefined(listener))
|
||||
{
|
||||
throw "Listener can not be null.";
|
||||
}
|
||||
|
@@ -37,7 +37,7 @@ objects.extend(web2d.Group, web2d.Element);
|
||||
*/
|
||||
web2d.Group.prototype.removeChild = function(element)
|
||||
{
|
||||
if (!element)
|
||||
if (!core.Utils.isDefined(element))
|
||||
{
|
||||
throw "Child element can not be null";
|
||||
}
|
||||
@@ -61,7 +61,7 @@ web2d.Group.prototype.removeChild = function(element)
|
||||
*/
|
||||
web2d.Group.prototype.appendChild = function(element)
|
||||
{
|
||||
if (!element)
|
||||
if (!core.Utils.isDefined(element))
|
||||
{
|
||||
throw "Child element can not be null";
|
||||
}
|
||||
@@ -144,7 +144,7 @@ web2d.Group.prototype.getCoordSize = function()
|
||||
|
||||
web2d.Group.prototype.appendDomChild = function(DomElement)
|
||||
{
|
||||
if (!DomElement)
|
||||
if (!core.Utils.isDefined(DomElement))
|
||||
{
|
||||
throw "Child element can not be null";
|
||||
}
|
||||
|
@@ -56,7 +56,7 @@ web2d.Workspace.prototype._disableTextSelection = function()
|
||||
contaier.onselectstart = new Function("return false");
|
||||
|
||||
//if the browser is NS6
|
||||
if (window.sidebar)
|
||||
if (core.Utils.isDefined(window.sidebar))
|
||||
{
|
||||
contaier.onmousedown = disabletext;
|
||||
contaier.onclick = reEnable;
|
||||
@@ -73,7 +73,7 @@ web2d.Workspace.prototype.getType = function()
|
||||
*/
|
||||
web2d.Workspace.prototype.appendChild = function(element)
|
||||
{
|
||||
if (!element)
|
||||
if (!core.Utils.isDefined(element))
|
||||
{
|
||||
throw "Child element can not be null";
|
||||
}
|
||||
@@ -96,7 +96,7 @@ web2d.Workspace.prototype.appendChild = function(element)
|
||||
*/
|
||||
web2d.Workspace.prototype.addItAsChildTo = function(element)
|
||||
{
|
||||
if (!element)
|
||||
if (!core.Utils.isDefined(element))
|
||||
{
|
||||
throw "Workspace div container can not be null";
|
||||
}
|
||||
@@ -232,7 +232,7 @@ web2d.Workspace.prototype.getCoordSize = function()
|
||||
*/
|
||||
web2d.Workspace.prototype.removeChild = function(element)
|
||||
{
|
||||
if (!element)
|
||||
if (!core.Utils.isDefined(element))
|
||||
{
|
||||
throw "Child element can not be null";
|
||||
}
|
||||
|
@@ -36,7 +36,7 @@ web2d.peer.svg.ElementPeer.prototype.setChildren = function(children)
|
||||
web2d.peer.svg.ElementPeer.prototype.getChildren = function()
|
||||
{
|
||||
var result = this._children;
|
||||
if (!result)
|
||||
if (!core.Utils.isDefined(result))
|
||||
{
|
||||
result = [];
|
||||
this._children = result;
|
||||
@@ -270,7 +270,7 @@ web2d.peer.svg.ElementPeer.prototype.updateStrokeStyle = function()
|
||||
web2d.peer.svg.ElementPeer.prototype.attachChangeEventListener = function(type, listener)
|
||||
{
|
||||
var listeners = this.getChangeEventListeners(type);
|
||||
if (!listener)
|
||||
if (!core.Utils.isDefined(listener))
|
||||
{
|
||||
throw "Listener can not be null";
|
||||
}
|
||||
@@ -280,7 +280,7 @@ web2d.peer.svg.ElementPeer.prototype.attachChangeEventListener = function(type,
|
||||
web2d.peer.svg.ElementPeer.prototype.getChangeEventListeners = function(type)
|
||||
{
|
||||
var listeners = this._changeListeners[type];
|
||||
if (!listeners)
|
||||
if (!core.Utils.isDefined(listeners))
|
||||
{
|
||||
listeners = [];
|
||||
this._changeListeners[type] = listeners;
|
||||
|
@@ -53,7 +53,7 @@ web2d.peer.svg.RectPeer.prototype.setSize = function(width, height)
|
||||
web2d.peer.svg.RectPeer.superClass.setSize.call(this, width, height);
|
||||
|
||||
var min = width < height?width:height;
|
||||
if (this._arc)
|
||||
if (core.Utils.isDefined(this._arc))
|
||||
{
|
||||
// Transform percentages to SVG format.
|
||||
var arc = (min / 2) * this._arc;
|
||||
|
@@ -45,7 +45,7 @@ web2d.peer.svg.TextPeer.prototype.setText = function(text)
|
||||
{
|
||||
text = core.Utils.escapeInvalidTags(text);
|
||||
var child = this._native.firstChild;
|
||||
if (child)
|
||||
if (core.Utils.isDefined(child))
|
||||
{
|
||||
this._native.removeChild(child);
|
||||
}
|
||||
@@ -63,7 +63,7 @@ web2d.peer.svg.TextPeer.prototype.setPosition = function(x, y)
|
||||
{
|
||||
this._position = {x:x, y:y};
|
||||
var height = this._font.getSize();
|
||||
if(this._parent && this._native.getBBox)
|
||||
if(core.Utils.isDefined(this._parent) && core.Utils.isDefined(this._native.getBBox))
|
||||
height = this.getHeight();
|
||||
var size = parseInt(height);
|
||||
this._native.setAttribute('y', y+size*3/4);
|
||||
|
@@ -21,7 +21,7 @@ web2d.peer.utils.EventUtils =
|
||||
broadcastChangeEvent:function (elementPeer, type)
|
||||
{
|
||||
var listeners = elementPeer.getChangeEventListeners(type);
|
||||
if (listeners)
|
||||
if (core.Utils.isDefined(listeners))
|
||||
{
|
||||
for (var i = 0; i < listeners.length; i++)
|
||||
{
|
||||
|
Reference in New Issue
Block a user