Posts
In case anyone else is having the same problems I was setting up Ruby on Rails on Netbeans -
I found a bug with inheritance in IE8 table header element. The text-align doesn't get inherited from the table but has to be applied more specifically to the th element. Other browsers including IE6 and IE7 inherit the text-alignment from the table.
I have a question about how to handle links which have a JavaScript action in the onclick but do not navigate to another page. This would be a link which toggles the display of something on the page, for example. I am wondering what the best thing to do with the href is. ( I have left out titles to simplify this example.)
<a href="???" onclick="doSomething();">link text</a> or
<a href="???" onclick="doSomething();return false;">link text</a>
href="javascript://return%20false;" or href="javascript://return false;" doesn't work with webkit
What do you use and why?
UPDATE:
I found all the href="javascript://return%20false;" and href="javascript://return false;" and replaced them with href="javascript:void(0);" or href="javascript:void 0;". I found that if the browser got to the href in some cases the javascript in the onclick was actually being voided, or the return being ignored, so it didn't work.
If I added "return false;" on the end of whatever was in the onclick it was fine. If you put "return false" at the end of the onclick to prevent the href being used, it doesn't matter very much what's in the href just so long as the browser never gets there. For my purposes, I wanted to keep the browser from the href, but also wanted to put something in there that wouldn't cause trouble if the browser did get there by accident (the accident being me forgetting to put a "return false" in the onclick. Putting "return false" at the end of an external function didn't work).
I liked href="#null" because it isn't javascript and seemed to work fine. One of my coworkers pointed out that it would mess up SEO because spiders would try to follow and index the bogus anchor. Users could bookmark it too. So #null is out.
href="javascript:;" didn't void anything and didn't seem to cause errors, so that's what I'm using. I'm also adding "return false".
I had read that browsers are supposed to evaluate the onclick before the href. Someone suggested that some browsers might evaluate them in their order of appearance in the link. I have not looked into this much, but in my very limited testing it seems like the onclick does get evaluated first.
As you can see, binding isn’t really that confusing, it’s just hard to explain in a way people can understand it.
So far no amount of ninjas or foo's have cleared this up for me. I have learned that all the world is an object, and I have found a hack to do what I was originally trying to use bind() for.