@micro-zoe/micro-app 1.0.0-rc.11 → 1.0.0-rc.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.ts CHANGED
@@ -158,6 +158,7 @@ declare module '@micro-zoe/micro-app/libs/utils' {
158
158
  export function isDocumentShadowRoot(target: unknown): target is DocumentFragment;
159
159
  export function isMicroAppBody(target: unknown): target is HTMLElement;
160
160
  export function isMicroAppHead(target: unknown): target is HTMLElement;
161
+ export function isWebComponentElement(target: unknown): boolean;
161
162
  export function isProxyDocument(target: unknown): target is Document;
162
163
  export function isTargetExtension(path: string, suffix: string): boolean;
163
164
  export function includes(target: unknown[], searchElement: unknown, fromIndex?: number): boolean;
package/lib/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- const version = '1.0.0-rc.11';
1
+ const version = '1.0.0-rc.12';
2
2
  // do not use isUndefined
3
3
  const isBrowser = typeof window !== 'undefined';
4
4
  // do not use isUndefined
@@ -131,6 +131,14 @@ function isMicroAppBody(target) {
131
131
  function isMicroAppHead(target) {
132
132
  return isElement(target) && target.tagName.toUpperCase() === 'MICRO-APP-HEAD';
133
133
  }
134
+ function isWebComponentElement(target) {
135
+ let result = toTypeString(target) === '[object HTMLElement]';
136
+ if (result) {
137
+ const tagName = target.tagName.toUpperCase();
138
+ result = result && !tagName.startsWith('MICRO-APP');
139
+ }
140
+ return result;
141
+ }
134
142
  // is ProxyDocument
135
143
  function isProxyDocument(target) {
136
144
  return toTypeString(target) === '[object ProxyDocument]';
@@ -3007,10 +3015,6 @@ function updateElementInfo(node, appName) {
3007
3015
  };
3008
3016
  }
3009
3017
  }
3010
- if (isImageElement(node) || isVideoElement(node) || isAudioElement(node)) {
3011
- // @ts-ignore
3012
- node.crossOrigin = 'anonymous';
3013
- }
3014
3018
  rawDefineProperties(node, props);
3015
3019
  /**
3016
3020
  * In FireFox, iframe Node.prototype will point to native Node.prototype after insert to document
@@ -5927,7 +5931,10 @@ function patchDocumentPrototype(appName, microAppWindow) {
5927
5931
  return range;
5928
5932
  };
5929
5933
  microRootDocument.prototype.createElement = function createElement(tagName, options) {
5930
- const element = rawMicroCreateElement.call(this, tagName, options);
5934
+ let element = rawMicroCreateElement.call(this, tagName, options);
5935
+ if (isWebComponentElement(element)) {
5936
+ element = rawMicroCreateElement.call(rawDocument, tagName, options);
5937
+ }
5931
5938
  return updateElementInfo(element, appName);
5932
5939
  };
5933
5940
  microRootDocument.prototype.createElementNS = function createElementNS(namespaceURI, name, options) {