摘要:代码资料文件文件文件关于系列的的网页的操作需要权限的相关文档关于浏览器无法一些元素无法设置属性的解决方案和原因
react代码资料:
文件:packages/react-dom/src/client/setInnerHTML.js
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import {Namespaces} from "../shared/DOMNamespaces";
import createMicrosoftUnsafeLocalFunction from "../shared/createMicrosoftUnsafeLocalFunction";
// SVG temp container for IE lacking innerHTML
let reusableSVGContainer;
/**
* Set the innerHTML property of a node
*
* @param {DOMElement} node
* @param {string} html
* @internal
*/
const setInnerHTML = createMicrosoftUnsafeLocalFunction(function(
node: Element,
html: string,
): void {
// IE does not have innerHTML for SVG nodes, so instead we inject the
// new markup in a temp node and then move the child nodes across into
// the target node
if (node.namespaceURI === Namespaces.svg && !("innerHTML" in node)) {
reusableSVGContainer =
reusableSVGContainer || document.createElement("div");
reusableSVGContainer.innerHTML = "";
const svgNode = reusableSVGContainer.firstChild;
while (node.firstChild) {
node.removeChild(node.firstChild);
}
while (svgNode.firstChild) {
node.appendChild(svgNode.firstChild);
}
} else {
node.innerHTML = html;
}
});
export default setInnerHTML;
文件:packages/react-dom/src/shared/createMicrosoftUnsafeLocalFunction.js
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/* globals MSApp */
/**
* Create a function which has "unsafe" privileges (required by windows8 apps)
*/
const createMicrosoftUnsafeLocalFunction = function(func) {
if (typeof MSApp !== "undefined" && MSApp.execUnsafeLocalFunction) {
return function(arg0, arg1, arg2, arg3) {
MSApp.execUnsafeLocalFunction(function() {
return func(arg0, arg1, arg2, arg3);
});
};
} else {
return func;
}
};
export default createMicrosoftUnsafeLocalFunction;
文件:packages/react-dom/src/shared/DOMNamespaces.js
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
const MATH_NAMESPACE = "http://www.w3.org/1998/Math/MathML";
const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
export const Namespaces = {
html: HTML_NAMESPACE,
mathml: MATH_NAMESPACE,
svg: SVG_NAMESPACE,
};
关于Windows8系列的APP的网页的innerHTML操作需要权限的相关文档:
execUnsafeLocalFunction method : https://msdn.microsoft.com/zh...
The new Windows 10 security model for HTML/Javascript apps. : https://github.com/MicrosoftE...
关于IE浏览器无法一些元素无法设置innerHTML属性的解决方案和原因:https://stackoverflow.com/que...
The property is read/write for all objects except the following, for which it is read-only: COL, COLGROUP, FRAMESET, HEAD, HTML, STYLE, TABLE, TBODY, TFOOT, THEAD, TITLE, TR.
function setTBodyInnerHTML(tbody, html) {
var temp = tbody.ownerDocument.createElement("div");
temp.innerHTML = "文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。
转载请注明本文地址:https://www.ucloud.cn/yun/99391.html
摘要:对的两个主要拓展是选择和。以下插入标记的拓展已经纳入了规范。在写模式下,会根据指定的字符串创建新的子树,然后用这个子树完全替换调用元素。在删除带有时间处理程序或引用了其他对象子树时,就有可能导致内存占用问题。 尽管DOM作为API已经非常完善了,但为了实现更多功能,仍然会有一些标准或专有的拓展。2008年之前,浏览器中几乎所有的拓展都是专有的,此后W3C着手将一些已经成为事实标准的专...
摘要:相关最大的特性就在于直接操纵网页上的节点,从而实现网页的局部刷新而非全局刷新。该回调函数会在送回响应的时候被调用。当然了,如果浏览器不支持对象,会返回,在这时需要进行额外的处理。 前言 马上就要参加一个团队项目进行React的前端开发了。最近正在着手熟练React语法,然后发现本质上还是建立在对javascript的深刻理解上。市面上在js基础上封装出了非常多优秀的车轮,其中最被新手广...
阅读 2935·2023-04-26 02:18
阅读 1472·2021-10-14 09:43
阅读 4041·2021-09-26 10:00
阅读 7902·2021-09-22 15:28
阅读 2752·2019-08-30 15:54
阅读 2838·2019-08-30 15:52
阅读 721·2019-08-29 11:30
阅读 3705·2019-08-29 11:05