--- title: Selection.selectAllChildren() slug: Web/API/Selection/selectAllChildren translation_of: Web/API/Selection/selectAllChildren ---
Selection.selectAllChildren()把指定元素的所有子元素设为选中区域,并取消之前的选中区域。
sel.selectAllChildren(parentNode)
parentNode
footer = document.getElementById("footer"); window.getSelection().selectAllChildren(footer); /* Everything inside the footer is now selected *
说明 | 状态 | 注释 |
---|---|---|
{{SpecName('HTML Editing', '#dom-selection-selectallchildren', 'Selection.selectAllChildren()')}} | {{Spec2('HTML Editing')}} | Initial definition |
{{SpecName('Selection API', '#widl-Selection-selectAllChildren-void-Node-node', 'Selection.selectAllChildren()')}} | {{Spec2('Selection API')}} | Current |
{{Compat("api.Selection.selectAllChildren")}}