I’m using Polymer’s ShadowDOM and MutationObserver polyfills and need to: Detect when a HTMLCanvasElement is inserted so that I can perform layout (its width and height are undetermined through offsetWidth / offsetHeight when detached from the DOM tree) Detect when the element is removed so I can …
Tag: javascript
Notification popup doesn’t appear in chrome
I am trying to do a gmail similar type desktop notification . I am facing the difficulty to change the notification permission in chrome. The permission always shows denied in console if i use window.Notification.permission. If i manually change the permission in google chrome settings -> privacy -> con…
HtmlUnit wait for onclick event
I have this web code: This code work perfectly in Chrome. But I want to test it with HtmlUnit. I wrote: This code works randomly. Sometime the test passed and sometimes failed. I think it is due because of the asynchronous call to JS, but I couldn’t solve it. So how can I test it? Besides, there is bett…
Sum similar keys in an array of objects
I have an array of objects like the following: I need to add up all the values for objects with the same name. (Probably also other mathematical operations like calculate average.) For the example above the result would be: Answer First iterate through the array and push the ‘name’ into another ob…
Google Maps API v3 Heatmaps Error: “Cannot read property ‘HeatmapLayer’ of undefined”
I am trying to load a Heatmaps layer onto my google maps, but for some reason I just keep getting the error “Cannot read property ‘HeatmapLayer’ of undefined.” Here is the jsFiddle: http://jsfiddle.net/9HQ2a/3/ Answer Add the visualization library to the URL when loading the google map…
Leaflet circleMarkers don´t show up
I am trying to draw hundres of circleMarker in a Leaflet map, I am using flask and foundation.js, the same code work in different app built with bootstrap.js This is my code: At the bottom I tried a fixed marker which appears and fixed circle which doesn´t, could it be a problem with foundation.js? Because in…
How to set cell width when export .xlsx files with js-xlsx
I am trying to set a fixed column/cell width to my exported excel files with js-xlsx. EDIT: Here is the source of js-xlsx: https://github.com/SheetJS/js-xlsx Answer I found a snippet the the write test here https://github.com/SheetJS/js-xlsx/blob/master/tests/write.js#L14-L19 For quick reference, where ws is …
Issue with calling parent of object onClick
Having a problem with this one-page site where the idea is you click on the links and a box slides down but it also needs a close function to bring it back up. Problem is the close button is in the element to be animated, so it needs to be called by its’ parent, I presume. I’ve tried a variety
Jquery ajax returning 404 not found
I’m using Ajax to pass my form data and files to a PHP file for processing. Javascript: ValidateApplication.php definitely exists. I can view it if I type in the address into the web browser, however when I submit the form chrome console returns 404. The PHP is in the same folder as the HTML page the Ja…
how to add markers with OpenLayers 3
I’m trying to add makers on a OpenLayers 3 map. The only example I have found is this one in the OpenLayers example list. But the example uses ol.Style.Icon instead of something like OpenLayers.Marker in OpenLayers 2. First Question The only difference would be that you have to set the image Url but is …