how to make :focus work?

16 views
Skip to first unread message

Rui Lopes

unread,
Apr 14, 2014, 3:26:52 PM4/14/14
to phan...@googlegroups.com
Hi,

Is there a way to apply the :focus pseudo-class?

I've tried with:

    var ev = document.createEvent("MouseEvents");
    ev.initEvent("click", true, true);
    document.querySelector("#text").dispatchEvent(ev);

And with jQuery:

    $("#text").focus();

Even though the document.activeElement has the correct element, the :focus CSS pseudo-class is not applied :-(

Any idea how to make this work?

-- RGL

PS https://github.com/ariya/phantomjs/issues/11432 reports this issue. Is there anyone working on a solution?
Reply all
Reply to author
Forward
0 new messages