博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
一个html标签到底包含了多少信息(1)
阅读量:6351 次
发布时间:2019-06-22

本文共 5958 字,大约阅读时间需要 19 分钟。

先来看一段代码:

var dom = document.querySelector('body');for(var i in dom){    console.log(i,dom[i])}

可以看到很多,来整理一下,总共有三大类(我自己分的,没有科学依据)

除了一些私有属性、方法(比如a的私有属性href等)和一些空的属性

  1. attributes

  2. events

  3. methods


attributes

根据value类型又分为了几个小分类:

1.普通属性

text

link
vLink
aLink
title
lang
translate true
dir
hidden false
tabIndex -1
accessKey
draggable false
spellcheck true
contentEditable inherit
isContentEditable false
innerText
images
Features
outerText
webkitdropzone
namespaceURI
prefix null
innerHTML
outerHTML
shadowRoot null
baseURI
isConnected true
baseURI
isConnected true
nodeValue null
textContent

2.样式属性

bgColor

background
offsetTop 0
offsetLeft 0
offsetWidth 1333
offsetHeight 50
scrollTop 0
scrollLeft 0
scrollWidth 1333
scrollHeight 950
clientTop 0
clientLeft 0
clientWidth 1333
clientHeight 50

3.dom操作属性

offsetParent null

localName body
tagName BODY
previousElementSibling
nextElementSibling
children
firstElementChild
lastElementChild
childElementCount
nodeType 1
nodeName BODY
ownerDocument #document
parentNode
parentElement
childNodes
firstChild
lastChild
previousSibling
nextSibling null

4.其他对象属性

style CSSStyleDeclaration {}

dataset DOMStringMap {}
attributes NamedNodeMap {length: 0}

5.我不知道的类型

ELEMENT_NODE 1

ATTRIBUTE_NODE 2
TEXT_NODE 3
CDATA_SECTION_NODE 4
ENTITY_REFERENCE_NODE 5
ENTITY_NODE 6
PROCESSING_INSTRUCTION_NODE 7
COMMENT_NODE 8
DOCUMENT_NODE 9
DOCUMENT_TYPE_NODE 10
DOCUMENT_FRAGMENT_NODE 11
NOTATION_NODE 12
DOCUMENT_POSITION_DISCONNECTED 1
DOCUMENT_POSITION_PRECEDING 2
DOCUMENT_POSITION_FOLLOWING 4
DOCUMENT_POSITION_CONTAINS 8
DOCUMENT_POSITION_CONTAINED_BY 16
DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC 32

events

onbeforecopy null

onbeforecut null
onbeforepaste null
oncopy null
oncut null
onpaste null
onsearch null
onselectstart null
onwheel null
onwebkitfullscreenchange null
onwebkitfullscreenerror null
onblur null
onerror null
onfocus null
onload null
onresize null
onscroll null
onbeforeunload null
onhashchange null
onlanguagechange null
onmessage null
onoffline null
ononline null
onpagehide null
onpageshow null
onpopstate null
onstorage null
onunload null
onorientationchange null
onrejectionhandled null
onunhandledrejection null
onabort null
oncancel null
oncanplay null
oncanplaythrough null
onchange null
onclick null
onclose null
oncontextmenu null
oncuechange null
ondblclick null
ondrag null
ondragend null
ondragenter null
ondragleave null
ondragover null
ondragstart null
ondrop null
ondurationchange null
onemptied null
onended null
oninput null
oninvalid null
onkeydown null
onkeypress null
onkeyup null
onloadeddata null
onloadedmetadata null
onloadstart null
onmousedown null
onmouseenter null
onmouseleave null
onmousemove null
onmouseout null
onmouseover null
onmouseup null
onmousewheel null
onpause null
onplay null
onplaying null
onprogress null
onratechange null
onreset null
onseeked null
onseeking null
onselect null
onshow null
onstalled null
onsubmit null
onsuspend null
ontimeupdate null
ontoggle null
onvolumechange null
onwaiting null
ontouchcancel null
ontouchend null
ontouchmove null
ontouchstart null

methods

click click() { [native code] }

focus focus() { [native code] }
blur blur() { [native code] }
hasAttributes hasAttributes() { [native code] }
getAttribute getAttribute() { [native code] }
getAttributeNS getAttributeNS() { [native code] }
setAttribute setAttribute() { [native code] }
setAttributeNS setAttributeNS() { [native code] }
removeAttribute removeAttribute() { [native code] }
removeAttributeNS removeAttributeNS() { [native code] }
hasAttribute hasAttribute() { [native code] }
hasAttributeNS hasAttributeNS() { [native code] }
getAttributeNode getAttributeNode() { [native code] }
getAttributeNodeNS getAttributeNodeNS() { [native code] }
setAttributeNode setAttributeNode() { [native code] }
setAttributeNodeNS setAttributeNodeNS() { [native code] }
removeAttributeNode removeAttributeNode() { [native code] }
closest closest() { [native code] }
matches matches() { [native code] }
webkitMatchesSelector webkitMatchesSelector() { [native code] }
getElementsByTagName getElementsByTagName() { [native code] }
getElementsByTagNameNS getElementsByTagNameNS() { [native code] }
getElementsByClassName getElementsByClassName() { [native code] }
insertAdjacentElement insertAdjacentElement() { [native code] }
insertAdjacentText insertAdjacentText() { [native code] }
insertAdjacentHTML insertAdjacentHTML() { [native code] }
createShadowRoot createShadowRoot() { [native code] }
getDestinationInsertionPoints getDestinationInsertionPoints() { [native code] }
requestPointerLock requestPointerLock() { [native code] }
getClientRects getClientRects() { [native code] }
getBoundingClientRect getBoundingClientRect() { [native code] }
scrollIntoView scrollIntoView() { [native code] }
scrollIntoViewIfNeeded scrollIntoViewIfNeeded() { [native code] }
animate animate() { [native code] }
remove remove() { [native code] }
webkitRequestFullScreen webkitRequestFullScreen() { [native code] }
webkitRequestFullscreen webkitRequestFullscreen() { [native code] }
querySelector querySelector() { [native code] }
querySelectorAll querySelectorAll() { [native code] }
hasChildNodes hasChildNodes() { [native code] }
normalize normalize() { [native code] }
cloneNode cloneNode() { [native code] }
isEqualNode isEqualNode() { [native code] }
isSameNode isSameNode() { [native code] }
compareDocumentPosition compareDocumentPosition() { [native code] }
contains contains() { [native code] }
lookupPrefix lookupPrefix() { [native code] }
lookupNamespaceURI lookupNamespaceURI() { [native code] }
isDefaultNamespace isDefaultNamespace() { [native code] }
insertBefore insertBefore() { [native code] }
appendChild appendChild() { [native code] }
replaceChild replaceChild() { [native code] }
removeChild removeChild() { [native code] }
addEventListener addEventListener() { [native code] }
removeEventListener removeEventListener() { [native code] }
dispatchEvent dispatchEvent() { [native code] }

下一节详细分析

转载地址:http://qktla.baihongyu.com/

你可能感兴趣的文章
android 屏幕适配
查看>>
Android Activity的4种启动模式
查看>>
leetcode第一刷_Minimum Depth of Binary Tree
查看>>
pm2-webshell —— 基于浏览器的终端控制台
查看>>
Mysql基准测试
查看>>
Session 撰改演示
查看>>
【转】python3 发邮件实例(包括:文本、html、图片、附件、SSL、群邮件)
查看>>
事务隔离级别(图文详解)
查看>>
canvas系列教程08-canvas各种坑
查看>>
浅析package.json中的devdependencies 和 dependencies
查看>>
又一个 iOS 侧边栏组件: SideMenu
查看>>
Python每日一练0019
查看>>
vue.js 打包遇到的问题
查看>>
【译】更优秀的GraphQL官方中文文档-客户端如何使用
查看>>
git pull遇到的问题
查看>>
eclipse下maven spring项目环境配置
查看>>
无缝轮播
查看>>
CTS失败项分析(2)android.telephony.cts.VisualVoicemailServiceTest#testFilter_data
查看>>
三分钟,轻松了解Dapp
查看>>
GMQ交易平台满足不同客户群体的多种投资需求
查看>>