dom-events

How can I tell when the browser stops repainting DOM layers/nodes because they are obscured?

*爱你&永不变心* 提交于 2019-12-04 12:31:30
问题 Identification: I'm looking at all possible solutions for detecting when the FPS drop or the repaints/reflows stop happening in a browser due to the browser optimizing performance because an area of the document is out of view. Observation: So far most native HTML/JS solutions I have researched do not take into account the portion of the DOM, which has been obscured by other pieces of the page, or DOM which is below the fold. While sometimes content will be directly embedded in the parent

click() with links

∥☆過路亽.° 提交于 2019-12-04 11:46:59
I have a page with a few links that are all like this: <a href="/" class="answer-item" rel="0">10</a> I would like to use the click() function to simulate a user's click on one of them, but it doesn't seem to work in my tests. //Evaluate a mathematical expression from another part of the page var numberAnswer = eval(document.getElementById("question-title").getElementsByTagName("b")[0].innerHTML); //Builds an array with the links that may match the expression var choices = document.getElementsByClassName('answer-item'); //Iterates through array to find a match then clicks it for(var i in

Onsubmit event silently killed by onchange

自古美人都是妖i 提交于 2019-12-04 11:46:32
Onsubmit event can silently kill onchange event, if called simultaneously. I assume race condition in js engine. Tested in chrome, FF3, FF6 and IE9. To reproduce you need to change contents of input and click on submit button. Do not make any additional clicks between input change and submit button click. <div id="somediv"> <div>one</div> <div>two</div> </div> <form method="POST" id="someform"> <input type="text" name="input1" id="someinput" value="change me" /> <input type="submit" /> </form> <script type="text/javascript"> document.getElementById('someinput').onchange = function() { //some

What architectural pattern(s) should I use for my RIA? [closed]

喜你入骨 提交于 2019-12-04 08:40:41
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . I'm building a web application that interacts heavily with the DOM and need direction in making my code scalable and maintainable. The

How can I create a simple page vertical scroll bar without using jQuery?

纵饮孤独 提交于 2019-12-04 07:49:02
问题 I have looked at I think all the scrollbars code but have not yet been able to find a simple one that does not use jQuery or a somewhat complex library. Has anyone created there own simple scrollbar using just Javascript? What I am looking for is an example of how this can be done. In particular I have a simple Bootstrap web page with: <body> <header> ....</header> <main> ......</main> </body> What I would like to do is to be able to have a small in page scroll bar appear to the right of the

How can I get x and y number at every click event on Google Maps?

自古美人都是妖i 提交于 2019-12-04 07:41:41
I want to retrieve x/y coordinates at every click-event on Google Maps. Could someone help me please? google.maps.event.addListener(map, "click", function (e) { document.form1.waypointLog.value = e.latLng.lat().toFixed(6) + ' |' + e.latLng.lng().toFixed(6); }); Source: https://groups.google.com/group/google-maps-js-api-v3/browse_thread/thread/3f4329e3a20e7b0b You can also check: http://forums.gpsreview.net/viewtopic.php?t=3632 来源: https://stackoverflow.com/questions/8766116/how-can-i-get-x-and-y-number-at-every-click-event-on-google-maps

Cross Browser Event object normalization?

て烟熏妆下的殇ゞ 提交于 2019-12-04 06:23:36
I'm looking for a good resource on event normalization on the event object. I'm trying to do it myself but I keep feeling like I'm going to miss something. Here's what I have so far, tell me if I missed anything. var eFix = function(e) { e = e || window.event; e.target = e.target || e.srcElement; e.offsetX = e.offsetX || e.layerX; e.offsetY = e.offsetY || e.layerY; e.relatedTarget = e.relatedTarget || e.type == 'mouseover' ? e.fromElement : e.toElement; e.target = e.target || e.srcElement; if (target.nodeType === 3) target = target.parentNode; //Safari bug return e; }; Has anyone seen a

Detect changes on the url

為{幸葍}努か 提交于 2019-12-04 05:52:25
I need something to detect changes on the url but the page doesn't do post back, it changes dynamically adding just the div inside the html, so the URL page is something like this http://www.examplepage/conversations/44455 and when I click on another section of the page it it is http://www.examplepage/conversations/44874 it changes not only at the end but like this http://www.examplepage/settings without doing post back and reloading the javascript so my question is, is there a way to detect those changes? and event listener but how? I search and everyone says hash event but I don't have any

How to fire keyboard events in Javascript?

╄→尐↘猪︶ㄣ 提交于 2019-12-04 05:37:31
问题 I'm giving a value to a textbox and then giving focus to it. document.getElementById('textbox').value="abcd"; document.getElementById('textbox').focus(); Then, I am creating a keyboard event and trying to fire the CTRL + A key combination (trying to select the text inside the textbox ) by writing the following code: var myEvent = document.createEvent('KeyboardEvent'); myEvent.initKeyEvent("keypress", true, true, window, true, false, false, false, 0, 97); document.getElementById('textbox')

JavaScript Event Listeners for when the DOM changes [duplicate]

我只是一个虾纸丫 提交于 2019-12-04 05:24:15
This question already has an answer here: Is there a JavaScript / jQuery DOM change listener? 5 answers I'm writing a Mozilla Firefox Extension (Javascript without the BS of having to identify if it's IE or Firefox), where I find myself stuck in the following situation. On a page load, I add event listeners like so: extension.addEventListener("DOMContentLoaded", extension.onPageLoad, true); That would execute m "onPageLoad()" method as soon as the DOM is loaded, meaning all data is received. And that works, but I need to find a way to add a listener for when the DOM changes . The extension