dom

getBBox() vs getBoundingClientRect() vs getClientRects()

余生颓废 提交于 2020-08-21 01:08:25
问题 I am unable to find an explicit reference for the use of these functions: getBBox() vs getBoundingClientRect() vs getClientRects() . Could you explain what they do and what are the coordinates (and their referential) they return? 回答1: getBBox is defined in the SVG specification it returns coordinates in the local coordinate system after the application of transforms. getBoundingClientRect and getClientRects are defined in the CSSOM specification. Their main difference is that they return

onSubmit event on a button element will it work? [closed]

若如初见. 提交于 2020-08-20 08:54:19
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . The following is the code. <html> <head> <script type="text/javascript"> function call() { alert("hai"); } </script> </head> <body> <form name="login" method="post" action=""> <input type="submit" name="Submit"

Give the difference between input.value and input.textContent. Why is one used instead of the other?

天涯浪子 提交于 2020-08-19 00:46:48
问题 Why is it that input.value is used instead of input.textContent . What is the difference between both? for example, if I want to retrieve content from an input box. <input type="number"> I have to use this code var input = document.querySelector("input"); input.value instead of this one input.textContent Just want to get a clearer understanding of each. 回答1: From MDN: [...] textContent returns the concatenation of the textContent of every child node, excluding comments and processing

Give the difference between input.value and input.textContent. Why is one used instead of the other?

若如初见. 提交于 2020-08-19 00:44:29
问题 Why is it that input.value is used instead of input.textContent . What is the difference between both? for example, if I want to retrieve content from an input box. <input type="number"> I have to use this code var input = document.querySelector("input"); input.value instead of this one input.textContent Just want to get a clearer understanding of each. 回答1: From MDN: [...] textContent returns the concatenation of the textContent of every child node, excluding comments and processing

Change color of <a> item with querySelectorAll and specific innerHTML

岁酱吖の 提交于 2020-08-10 20:17:58
问题 I need to change a menu dropdown item only if it is "Saldos". I'm using a array to select all the parent elements and passing it to a function, which selects the inside and checks if it contains the text. However it does not work, even if I put if(1). var menuArrayHeader = document.querySelectorAll(".drawer__nav-item"); menuArrayHeader.forEach(verificarVermelho) function verificarVermelho(menuItemParent){ var menuItem =menuItemParent.querySelector(".drawer__nav-link"); console.log(menuItem

Change color of <a> item with querySelectorAll and specific innerHTML

本秂侑毒 提交于 2020-08-10 20:14:25
问题 I need to change a menu dropdown item only if it is "Saldos". I'm using a array to select all the parent elements and passing it to a function, which selects the inside and checks if it contains the text. However it does not work, even if I put if(1). var menuArrayHeader = document.querySelectorAll(".drawer__nav-item"); menuArrayHeader.forEach(verificarVermelho) function verificarVermelho(menuItemParent){ var menuItem =menuItemParent.querySelector(".drawer__nav-link"); console.log(menuItem

Change color of <a> item with querySelectorAll and specific innerHTML

删除回忆录丶 提交于 2020-08-10 20:14:03
问题 I need to change a menu dropdown item only if it is "Saldos". I'm using a array to select all the parent elements and passing it to a function, which selects the inside and checks if it contains the text. However it does not work, even if I put if(1). var menuArrayHeader = document.querySelectorAll(".drawer__nav-item"); menuArrayHeader.forEach(verificarVermelho) function verificarVermelho(menuItemParent){ var menuItem =menuItemParent.querySelector(".drawer__nav-link"); console.log(menuItem

Unload/remove dynamically loaded css files

主宰稳场 提交于 2020-08-09 12:25:34
问题 After loading a css file like this: const themes = ['dark-theme.css', 'light-theme.css']; async function loadcss(file) { return await import(file); } loadcss(themes[0]).then(console.log) The console output is an empty object for me and a new annonymous < style> tag sits in the < head> of my index.html. So far so good, but what if I (in this example) want to change the theme to light-theme.css . That would merge both themes as dark-theme.css is already loaded. Is there a way to remove the <

Unload/remove dynamically loaded css files

左心房为你撑大大i 提交于 2020-08-09 12:25:10
问题 After loading a css file like this: const themes = ['dark-theme.css', 'light-theme.css']; async function loadcss(file) { return await import(file); } loadcss(themes[0]).then(console.log) The console output is an empty object for me and a new annonymous < style> tag sits in the < head> of my index.html. So far so good, but what if I (in this example) want to change the theme to light-theme.css . That would merge both themes as dark-theme.css is already loaded. Is there a way to remove the <

XPath 3 in browser

青春壹個敷衍的年華 提交于 2020-08-08 05:17:25
问题 When we see conformance chart, such as https://caniuse.com/#search=xpath and https://developer.microsoft.com/en-us/microsoft-edge/platform/status/domlevel3xpath/?q=xpath, it's usually about DOM Level 3 XPath that focuses on accessing DOM object using XPath 1.0 , but not necessarily XPath 3.0 or higher. Question 1 - Is there any explicit version requirement for browsers by W3C etc. to support newer versions of XPath? This XPath 1.0 feature works: document.evaluate( 'normalize-space(" X ")',