User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:22.214.171.124) Gecko/20070725 Firefox/126.96.36.199 Build Identifier: 2007-08-09-03-mozilla1.8 When an `xf:insert` uses a bind reference to identify the Node Set Binding node-set, then it also changes the in-scope evaluation context, which means that a relative XPath expression in the `origin` attribute will be evaluated with respect to the bind location, not the original in-scope evaluation context. Reproducible: Always
Created attachment 276031 [details] Demonstration of bug report The insert should copy (i.e. insert) a date element with a text node content, but instead it copies a date element with an empty element child, which is only present at the bind location (not the origin location).
Orbeon and Sidewinder both behave the same, which is different from our processor. We need to figure out why and who is right. According to the spec, "1. The insert context is determined. If the bind attribute is present or if the context attribute is not given, the insert context is the in-scope evaluation context". So to me, that means in this testcase the evaluation context should be: instance('containers')/target/date since that is the nodeset that @bind gives. So to me we are behaving correctly, but we certainly aren't behaving like the other processors.
I asked the W3C what the correct behavior is: http://lists.w3.org/Archives/Public/www-forms/2007Aug/0001.html
(In reply to comment #3) > I asked the W3C what the correct behavior is: > http://lists.w3.org/Archives/Public/www-forms/2007Aug/0001.html > The WG has spoken...the result from @bind should NOT provide the context for xpath evaluations on the xf:insert element. Orbeon and Sidewinder's behaviors are correct. Merle, please fix this accordingly. If this points out a flaw in the testsuite testcase, please mention that to Steve or Keith. Thanks.
Created attachment 277017 [details] testcase: using @model Additional testcase that uses @model instead of @bind.
Created attachment 277019 [details] [diff] [review] patch
Comment on attachment 277019 [details] [diff] [review] patch >Index: nsXFormsInsertDeleteElement.cpp >=================================================================== >+ rv = nsXFormsUtils::GetNodeContext(mElement, >+ nsXFormsUtils::ELEMENT_WITH_MODEL_ATTR, >+ getter_AddRefs(model), >+ getter_AddRefs(bindElement), >+ &outerBind, >+ getter_AddRefs(parentControl), >+ getter_AddRefs(contextNode), >+ nsnull, nsnull, PR_FALSE); nit: perhaps a comment here to point out that we are passing in PR_FALSE to tell GetNodeContext not to grab the context node from @bind. >+ // The insert/delete action is terminated with no effect if the context >+ // is the empty node-set. >+ //if (!model || !contextNode) nit: remove this commented out line if you don't need it. with those, r=me
Created attachment 279597 [details] [diff] [review] patch 2 Add comment; remove extraneous commented out code.
Comment on attachment 279597 [details] [diff] [review] patch 2 Not sure if XForms patches need approval while in M8 freeze. XForms is not part of the build.
Comment on attachment 279597 [details] [diff] [review] patch 2 According to mozilla.dev.planning, this doesn't need approval
checked into 1.8 branch via bug 410239.