Skip to content
Advertisement

Testing browser extensions

I’m going to write bunch of browser extensions (the same functionality for each popular browser). I hope, that some of the code will be shared, but I’m not sure about this yet. For sure some of extensions will use native API. I have not much experience with TDD/BDD, and I thought it’s good time to start folowing these ideas from

How to avoid ‘cannot read property of undefined’ errors?

In my code, I deal with an array that has some entries with many objects nested inside one another, where as some do not. It looks something like the following: This is giving me problems because I need to iterate through the array at times, and the inconsistency is throwing me errors like so: I am aware that I can

Iterate over a list of values using javascript

I am looking to iterate over a list of values using javascript. I have a list like this My goal is to pass each row into different functions based on the label. I am trying to figure out if a multidimensional array is the best way to go. Answer You get to define the matchesLabel function, it should return true

oncontextmenu=”return false;” is not working in Opera?

In my application having the requirement for disable the right click feature. So I used the oncontextmenu=”return false;” in the body tag. It works fine in all browsers except Opera. How can I disable the right click in Opera. ? I have searched a lot in Google and can’t find the solution there.Hope you people can help me for a

When is an event.target.value not a string?

I came accross value = String(event.target.value || “”) when a textinputs keyup/keydown event is fired. But i’m not sure when the event.target.value is not a string? Is this possible? When is something else passed off as an event.target.value? Answer If the event.target element is not an input type element, it will not have a value property. For example, if I

Push multiple elements to array

I’m trying to push multiple elements as one array, but getting an error: I’m trying to do similar stuff that I’d do in ruby, I was thinking that apply is something like *. Answer When using most functions of objects with apply or call, the context parameter MUST be the object you are working on. In this case, you need

Google Places Autocomplete Force Selection

I am using the JavaScript Google places autocomplete API v3. It works fine but I was wondering if there was a way to force the selection from the autocomplete, that is input that will not accept any free form text. I looked at the docs and didn’t see such an option but figured I would ask just to be safe.

Capture events in list

I would like to know how to capture events within the dropdown list when a user click on a “select” dropdown list. I would like for example to intercept events when different elements of list are on focus. I tried to tie event listeners to the option elements of the list but they do not capture anything. See sample code

Advertisement