Skip to content

Commit

Permalink
feat: a标签href 支持excludeAssetFilter
Browse files Browse the repository at this point in the history
  • Loading branch information
timhub66 committed Oct 16, 2024
1 parent 2f57bd9 commit 321b89b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/sandbox/iframe/element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ import {
isElement,
isNode,
isDocumentFragment,
isFunction,
isBrowser,
} from '../../libs/utils'
import {
updateElementInfo,
getIframeParentNodeDesc,
} from '../adapter'
import microApp from '../../micro_app'

/**
* patch Element & Node of child app
Expand Down Expand Up @@ -242,7 +245,11 @@ function patchIframeAttribute (url: string, microAppWindow: microAppWindowType):
((key === 'src' || key === 'srcset') && /^(img|script|video|audio|source|embed)$/i.test(this.tagName)) ||
(key === 'href' && /^(a|link|image)$/i.test(this.tagName))
) {
value = CompletionPath(value, url)
let _url = url
if (isBrowser && key === 'href' && /^a$/i.test(this.tagName) && isFunction(microApp.options.excludeAssetFilter) && microApp.options.excludeAssetFilter(value)) {
_url = document.baseURI
}
value = CompletionPath(value, _url)
}
rawMicroSetAttribute.call(this, key, value)
}
Expand Down

0 comments on commit 321b89b

Please sign in to comment.