html fragment & svg remove xml namespace
html fragment & svg remove xml namespace
https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment
https://developer.mozilla.org/en-US/docs/Web/API/Document/createDocumentFragment
const xmlToSVGConvert = (svgStr = ``) => {
const xml = /<\?xml[\s\S]*\?>/i;
let result = ``;
result = svgStr.replace(xml,``);
const index = result.indexOf(`>`);
// svg namespace
const viewport = `<svg data-uuid="live_map_svg" id="live_map_svg" width="100%" height="100%" viewBox="0 0 1000 600" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">`;
result = viewport + result.substr(index + 1);
return result;
};
xmlToSVGConvert(svgStr) {
const xml = /<\?xml[\s\S]*\?>/i;
let result = ``;
result = svgStr.replace(xml,``);
const index = result.indexOf(`>`);
// svg namespace
const viewport = `<svg data-uuid="live_map_svg" id="live_map_svg" width="100%" height="100%" viewBox="0 0 1000 600" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">`;
result = viewport + result.substr(index + 1);
return result;
},
shadow DOM
https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_shadow_DOM
https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot
https://www.html5rocks.com/en/tutorials/webcomponents/shadowdom/
https://developers.google.com/web/fundamentals/web-components/shadowdom
demo

https://codepen.io/xgqfrms/pen/vYOxxBK
html fragment & svg remove xml namespace的更多相关文章
- The tag 'DataGridTextColumn' does not exist in XML namespace ....
错误 10 The tag 'DataGridTextColumn' does not exist in XML namespace 'http://schemas.microsoft.com/win ...
- Java 异常 —— java.io.InvalidClassException: javax.xml.namespace.QName; local class incompatible
项目中有个 WebService 接口,调试时使用 Main 方法运行,别人的机器上都能运行,就笔者的机器出问题.他们说是RP的问题…… 异常信息: java.io.InvalidClassExcep ...
- XML Namespace (xmlns) 属性
http://www.w3school.com.cn/xml/xml_namespaces.asp XML Namespace (xmlns) 属性 XML 命名空间属性被放置于元素的开始标签之中,并 ...
- 解决 weblogic poi3.9 报错 a different type with name "javax/xml/namespace/QName"
解决 java.lang.LinkageError: loader constraint violation: loader (instance of weblogic/utils/classload ...
- Weblogic 9.2 启动时报错 javax.xml.namespace.QName
启动Weblogic 时会报错.javax.xml.namespace.QName; local class incompatible: stream classdesc serialVersionU ...
- Aspose WorkbookDesigner打开文件异常"Error xml namespace"
错误描述: 平台是VS2010的.Net Framework 需要用Aspose的WorkbookDesigner打开excel文件的时候产生异常 异常码是Aspose.Cells.Exception ...
- The property does not exist in XML namespace
自定义依赖属性,绑定在xaml文件中,无问题. 但是编译失败,报 The property does not exist in XML namespace 错误. 发现如果依赖属性定义在本程序集中,在 ...
- XML Namespace 命名空间
根据 Namespaces in XML W3C 推荐标准的定义,XML 命名空间 是由国际化资源标识符 (IRI) 标识的 XML 元素和属性集合:该集合通常称作 XML“词汇”. 定义 XML 命 ...
- fragment显示 Binary XML file line #12: Error inflating class fragment 错误
问题 最近换了新机子,今天在静态用fragment时突然发现闪退,一看显示 Binary XML file line #12: Error inflating class fragment 错误 后面 ...
随机推荐
- Redis 实战 —— 11. 实现简单的社交网站
简介 前面介绍了广告定向的实现,它是一个查询密集型 (query-intensive) 程序,所以每个发给它的请求都会引起大量计算.本文将实现一个简单的社交网站,则会尽可能地减少用户在查看页面时系统所 ...
- java.util.List.subList使用注意
List<E> subList(int fromIndex, int toIndex); 它返回原来list的从[fromIndex, toIndex)之间这一部分的视图,之所以说是视图, ...
- Scala中使用fastJson 解析json字符串
Scala中使用fastJson 解析json字符串 添加依赖 2.解析json字符 2.1可以通过JSON中的parseObject方法,把json字符转转换为一个JSONObject对象 2.2然 ...
- 设计模式c++(4)——装饰者模式
装饰者模式动态地将责任附加到对象上.若要扩展功能,装饰者提供了比继承更有弹性的替代方案. 装饰者模式的整体思路比较简单,就是在类的实例中包含一个同类型的成员变量,然后用实例来装饰该成员变量.这样就就可 ...
- .net core 和 WPF 开发升讯威在线客服与营销系统:使用线程安全的 BlockingCollection 实现高性能的数据处理
本系列文章详细介绍使用 .net core 和 WPF 开发 升讯威在线客服与营销系统 的过程.本产品已经成熟稳定并投入商用. 在线演示环境:https://kf.shengxunwei.com 注意 ...
- xLua热更新插件
一.xLua插件下载安装 1.从GitHub上搜索并下载插件 2.将文件复制到unity中 3.检查是否有错误 二.在unity中调用lua 1.简单调用 在c#脚本中使用LuaEnv类可以运行lua ...
- 用powershell实现,管理github自动化
用powershell实现,管理github自动化 搜索关键字如下:PowerShellForGitHub powershell 传教士 原创文章.始于 2021-02-04 允许转载,但必须保留名 ...
- Linux下diff的操作详解
总述 Linux diff命令用于比较文件的差异.diff以逐行的方式,比较文本文件的异同处.特别是比较两个版本不同的文件,如果指定要比较目录,则diff会比较目录中相同文件名的文件,但不会比较其中子 ...
- 2019牛客暑期多校训练营(第二场)D Kth Minimum Clique(第k团)
题意:给你n个点 求第k小的团 思路:暴力bfs+bitset压位 #include <bits/stdc++.h> using namespace std; const int N = ...
- Codeforces Round #636 (Div. 3)
比赛链接:https://codeforces.com/contest/1343 A - Candies 题意 有一数列 x + 2x + 4x + ... + 2k-1x = n,输出 k ≥ 2 ...