Showing posts with label uncompleted. Show all posts
Showing posts with label uncompleted. Show all posts

January 19, 2011

How to detect if a class implements an Interface?

I'm in the real need to know if, given a string className or object, it implements a particular interface. I'm specially interested in the string className part.

During the search, many seemingly valid options appeared: instanceof, is_subclass_of, is_a, ReflectionClass::ImplementsInterface, class_implements… Which one to use? Let's do some testing!

March 25, 2009

Cross-browser inline style with jQuery

Currently I'm developing some web applications for internal use, porting from some old ones.

I'd love jQuery, the jQuery way to do asynchronous requests is brilliant. Then I developed a plugin for my apps. Basically, it "automagically" catches all clicks on links, sends an AJAH request and loads the response inside a container.

The problem came when the response contains <STYLE> or <LINK> tags. While using Firefox and Opera all was great. But, oh $h*t, no style was applied with IE6, IE7, Chrome or Safari. I was thinking that was my plugin's fault, but when I test the use case without it, the problem remains. No style applied.