xdp.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /**
  2. * @licstart The following is the entire license notice for the
  3. * Javascript code in this page
  4. *
  5. * Copyright 2021 Mozilla Foundation
  6. *
  7. * Licensed under the Apache License, Version 2.0 (the "License");
  8. * you may not use this file except in compliance with the License.
  9. * You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS,
  15. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. * See the License for the specific language governing permissions and
  17. * limitations under the License.
  18. *
  19. * @licend The above is the entire license notice for the
  20. * Javascript code in this page
  21. */
  22. "use strict";
  23. Object.defineProperty(exports, "__esModule", {
  24. value: true
  25. });
  26. exports.XdpNamespace = void 0;
  27. var _namespaces = require("./namespaces.js");
  28. var _xfa_object = require("./xfa_object.js");
  29. const XDP_NS_ID = _namespaces.NamespaceIds.xdp.id;
  30. class Xdp extends _xfa_object.XFAObject {
  31. constructor(attributes) {
  32. super(XDP_NS_ID, "xdp", true);
  33. this.uuid = attributes.uuid || "";
  34. this.timeStamp = attributes.timeStamp || "";
  35. this.config = null;
  36. this.connectionSet = null;
  37. this.datasets = null;
  38. this.localeSet = null;
  39. this.stylesheet = new _xfa_object.XFAObjectArray();
  40. this.template = null;
  41. }
  42. [_xfa_object.$onChildCheck](child) {
  43. const ns = _namespaces.NamespaceIds[child[_xfa_object.$nodeName]];
  44. return ns && child[_xfa_object.$namespaceId] === ns.id;
  45. }
  46. }
  47. class XdpNamespace {
  48. static [_namespaces.$buildXFAObject](name, attributes) {
  49. if (XdpNamespace.hasOwnProperty(name)) {
  50. return XdpNamespace[name](attributes);
  51. }
  52. return undefined;
  53. }
  54. static xdp(attributes) {
  55. return new Xdp(attributes);
  56. }
  57. }
  58. exports.XdpNamespace = XdpNamespace;