提交 142c31bc 编写于 作者: K kohsuke

support "../foo" to refer to the "foo" parameter of the parent scope (the...

support "../foo" to refer to the "foo" parameter of the parent scope (the scope in the sense of the structured form submission.)

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@32530 71c3de6d-444a-0410-be80-ed276b4c234a
上级 5e736c21
......@@ -140,14 +140,22 @@ var FormChecker = {
* and returns that DOM node.
*/
function findNearBy(e,name) {
// does 'e' itself match the criteria?
// as some plugins use the field name as a parameter value, instead of 'value'
var p = findFormItem(e,name,function(e,filter) {
if (filter(e)) return e;
return null;
});
if (p!=null) return p; // including self, as some plugins use the field name as a parameter value, instead of 'value'
if (p!=null) return p;
var owner = findFormParent(e,null);
// handle "../foo" syntax
while (name.startsWith("../")) {
owner = findFormParent(owner,null);
name = name.substring(3);
}
p = findPreviousFormItem(e,name);
if (p!=null && findFormParent(p,null)==owner)
return p;
......@@ -971,7 +979,7 @@ function refillOnChange(e,onChange) {
function h() {
var params = {};
deps.each(function (d) {
params[shortenName(d.getAttribute("name"))] = controlValue(d);
params[d.name] = controlValue(d.control);
});
onChange(params);
}
......@@ -985,7 +993,7 @@ function refillOnChange(e,onChange) {
return;
}
c.addEventListener("change",h,false);
deps.push(c);
deps.push({name:name,control:c});
});
}
h(); // initial fill
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册