I'm looking around at the hand-coded dependency functions and they all seem to think that they are going to be called with parameters: `who`, `self`, and the parameters of the method they are the dependency function for. But for centuries, the callers of `applyConstraint` have been invoking dependency functions with no parameters (other than the implicit `this` parameter, which is the LzNode whose attribute is being constrained). E.g.:

/**
  * Returns the value for the give attribute
* @param String name: The name of the attribute whose value to return
  * @return String: The value for the given attribute
  */
function getAttr (name){
    if (this.attributes) return this.attributes[ name ];
}

/**
  * @access private
  */
prototype.getAttr.dependencies = function (who , self){
    return [ self, 'attributes' ];
}

It's pretty clear that getAttr.dependencies should be returning `[this, 'attributes']`. There are more:

/** @access private */
xpathQuery.dependencies = function ( who , self , p ){
    if (this.parsePath) {
        var pp  = this.parsePath( p );
return [ pp.hasDotDot ? self.context.getContext().ownerDocument : self ,
                 "DocumentChange" ];
    } else {
        return [  self , "DocumentChange" ];
    }
}

This is clearly never going to work, since `p` is never going to be passed.

---

Seems to me that the contract of a dependency function changed a while back, and no one ever got around to updating all these hand-made ones. A lot of them still have the vestigial `who, self` parameters, but their bodies have been re-written to refer to `this`. Others have a comment saying they need to be re-written. Still others are just plain broken.

Anyone know what is going on here? I plan to file a bug to get these either fixed or removed.

Reply via email to