MCPcopy Create free account
hub / github.com/Bistutu/FluentRead / replaceSensitiveWords

Function replaceSensitiveWords

entrypoints/main/dom.ts:424–447  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

422
423// 替换 svg 标签中的一些大小写敏感的词(html 不区分大小写,但 svg 标签区分大小写)
424function replaceSensitiveWords(text: string): string {
425 // 1. 使用正则匹配大小写敏感词
426 // 2. 逐个替换为正确大小写形式
427 return text.replace(/viewbox|preserveaspectratio|clippathunits|gradienttransform|patterncontentunits|lineargradient|clippath/gi, (match) => {
428 switch (match.toLowerCase()) {
429 case 'viewbox':
430 return 'viewBox';
431 case 'preserveaspectratio':
432 return 'preserveAspectRatio';
433 case 'clippathunits':
434 return 'clipPathUnits';
435 case 'gradienttransform':
436 return 'gradientTransform';
437 case 'patterncontentunits':
438 return 'patternContentUnits';
439 case 'lineargradient':
440 return 'linearGradient';
441 case 'clippath':
442 return 'clipPath';
443 default:
444 return match;
445 }
446 });
447}
448
449// 移除特定样式
450export function checkAndRemoveStyle(node: any, styleProperty: any) {

Callers 1

beautyHTMLFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected