Skip to content
Advertisement

Closest ancestor matching selector using native DOM?

Is anybody working on a jQuery.closest() equivalent in the DOM api? Looks like the Selectors Level 2 draft adds matches() equivalent to jQuery.is(), so native closest should be much easier to write. Has adding closest() to Selectors come up? Answer See the element.closest() documentation. Implementing such function with Element.matches() seems not optimal in terms of performance, cause apparently matches() will

JavaScript function parameter naming conventions [closed]

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 9 years ago.

Load one-script-after another

I have this simple function which loads scripts into the current DOM: They are loaded fine and without no errors. I know there are event handlers when loading scripts programmatically: onreadystatechange, and onload, etc Now I would like to wish to do the following: Load first script from the array, and when the event handlers are COMPLETE load the next

onunload does in Chrome

I am opening a new window as below to var nResult = window.showModalDialog(“getSelection.asp?Type=” + inputType, “”, “dialogHeight:220px; dialogWidth:400px; resizable=no; help:no; status:no”); Now on getSelection.asp I have following syntax for body <BODY onload=”RetrieveDialogArguments();document.thisForm.ok.focus();” onunload=”ReturnDialogArguments()” > when I put alert then found that onload event works and call to RetrieveDialogArguments() but onunload event does not work and function ReturnDialogArguments() does not call.

How do I insert HTML into Mongodb?

I keep getting kicked out of the shell when I try to paste in an HTML text file. How can this be done? Do I first need to use some javascript to encode it or something? Example: EDIT I put only single quotes inside my html and wrapped the whole thing in double-quotes, but still no good. shell error: Answer

EXEC_BAD_ACCESS error when using WebViewJavascriptBridge

I’m a very new iOS developer (I only started a few days ago), and I’m trying to utilize the WebViewJavascriptBridge class with a UIWebView that I’ve got on my Storyboard. Whenever I try to use it, I get an EXEC_BAD_ACCESS error. The trouble lines seem to be: To be exact, the last line. If I don’t make that request, I

Chain to pre defined functions with jQuery

I have been trying to chain this last bit of code to work nicely. It calls two functions that have been preset: I want the caption to be set once the image has slid. This has always been a confusing topic for me as I have tried different ways of calling it such as: But that does not work. Answer

Advertisement