XFA - Elements under an area must be bound (bug 1723734)
- aims to fix https://bugzilla.mozilla.org/show_bug.cgi?id=1723734.
This commit is contained in:
parent
849bab973c
commit
328383ea7a
@ -503,6 +503,10 @@ class Area extends XFAObject {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[$isBindable]() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
[$addHTML](html, bbox) {
|
[$addHTML](html, bbox) {
|
||||||
const [x, y, w, h] = bbox;
|
const [x, y, w, h] = bbox;
|
||||||
this[$extra].width = Math.max(this[$extra].width, x + w);
|
this[$extra].width = Math.max(this[$extra].width, x + w);
|
||||||
@ -2869,6 +2873,11 @@ class Field extends XFAObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
|
if (this.ui.numericEdit) {
|
||||||
|
value = parseFloat(value);
|
||||||
|
value = isNaN(value) ? "" : value.toString();
|
||||||
|
}
|
||||||
|
|
||||||
if (ui.children[0].name === "textarea") {
|
if (ui.children[0].name === "textarea") {
|
||||||
ui.children[0].attributes.textContent = value;
|
ui.children[0].attributes.textContent = value;
|
||||||
} else {
|
} else {
|
||||||
@ -5166,6 +5175,10 @@ class SubformSet extends XFAObject {
|
|||||||
}
|
}
|
||||||
return parent;
|
return parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[$isBindable]() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class SubjectDN extends ContentObject {
|
class SubjectDN extends ContentObject {
|
||||||
|
@ -1400,4 +1400,30 @@ describe("XFAParser", function () {
|
|||||||
).toEqual(["a", "b", "c", "d", "e"]);
|
).toEqual(["a", "b", "c", "d", "e"]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should make a binding with a element in an area", function () {
|
||||||
|
const xml = `
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<xdp:xdp xmlns:xdp="http://ns.adobe.com/xdp/">
|
||||||
|
<template xmlns="http://www.xfa.org/schema/xfa-template/3.3">
|
||||||
|
<subform name="A" mergeMode="matchTemplate">
|
||||||
|
<area>
|
||||||
|
<field name="B"/>
|
||||||
|
</area>
|
||||||
|
</subform>
|
||||||
|
</template>
|
||||||
|
<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">
|
||||||
|
<xfa:data>
|
||||||
|
<A><B>foobar</B></A>
|
||||||
|
</xfa:data>
|
||||||
|
</xfa:datasets>
|
||||||
|
</xdp:xdp>
|
||||||
|
`;
|
||||||
|
const root = new XFAParser().parse(xml);
|
||||||
|
const form = new Binder(root).bind();
|
||||||
|
|
||||||
|
expect(searchNode(form, form, "A..B..text")[0][$dump]().$content).toBe(
|
||||||
|
"foobar"
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user