Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
jQuery :inlineStyle selector filter extention
:inlineStyle filter
An inline style selector filter.
Usage: $("div:inlineStyle(display:none)"); // returns any divs with display style set to none
$("div:inlineStyle(width)"); // returns any divs with a width style set
$("div:inlineStyle"); // returns any divs with an inline style set
Written by Corban Brook @corban
$.expr[':'].inlineStyle = function(element, index, meta) {
var $element = $(element);
var style = $element.attr("style");
var match = meta[3];
var matchSelector, matchValue, value;
// Only interested in elements with an inline style set.
if (!style || style === "") {
return false;
if (match) {
if (match.indexOf(":") > 0) {
var pair = match.split(":");
matchSelector = pair[0];
matchValue = pair[1];
} else {
matchSelector = match;
value =[matchSelector];
if (typeof value === "undefined" || value === "") {
return false;
// Match param given, make sure this style exists and check vs match value if specified
return typeof matchValue !== "undefined" ? value === matchValue : true;
} else {
// No match param given, return true for elements which have any inline styles set
return true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.