Bug:installV3ShadowPiercer 中的 opts.debug 被忽略
文件: packages/core/lib/v3/dom/piercer.runtime.ts
V3ShadowPatchOptions 接口中定义了一个 debug?: boolean 选项:
export interface V3ShadowPatchOptions {
debug?: boolean;
tagExisting?: boolean;
}
但是,installV3ShadowPiercer 并没有使用 opts.debug,而是将
DEBUG 硬编码为 true,并在注释中也承认了这一点:
export function installV3ShadowPiercer(opts: V3ShadowPatchOptions = {}): void {
// hardcoded debug (remove later if desired)
const DEBUG = true;
这意味着无论调用方传入什么参数,console.info("[v3-piercer] attachShadow", ...)
都会在每次调用 attachShadow 时触发,V3ShadowPatchOptions 中的 debug 字段实际上成为了一个无效(未被使用)的 API。
期望行为:
DEBUG 应该基于 opts.debug ?? false 来设置,从而允许调用方控制日志输出的详细程度。
建议修复:
const DEBUG = opts.debug ?? false;
Bug:
installV3ShadowPiercer中的opts.debug被忽略文件:
packages/core/lib/v3/dom/piercer.runtime.tsV3ShadowPatchOptions接口中定义了一个debug?: boolean选项:但是,
installV3ShadowPiercer并没有使用opts.debug,而是将DEBUG硬编码为true,并在注释中也承认了这一点:这意味着无论调用方传入什么参数,
console.info("[v3-piercer] attachShadow", ...)都会在每次调用
attachShadow时触发,V3ShadowPatchOptions中的debug字段实际上成为了一个无效(未被使用)的 API。期望行为:
DEBUG应该基于opts.debug ?? false来设置,从而允许调用方控制日志输出的详细程度。建议修复: