DOM
Selection.selectAllChildren() 把指定元素的所有子元素设为选中区域,并取消之前的选中区域。
语法
selectAllChildren(parentNode)
参数
parentNode- : 所有 parentNode 元素的子元素会被设为选中区域,parentNode 本身除外。
示例
footer = document.getElementById("footer");
window.getSelection().selectAllChildren(footer);
/* Everything inside the footer is now selected */
规范
浏览器兼容性
参见
- 此方法所属的接口:Selection。
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
