• Stars
    star
    170
  • Rank 223,357 (Top 5 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 14 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

DEPRECATED: A jQuery plugin to enable the scoped attribute on style blocks

DEPRECATED

This project is no longer maintained. If there's anything useful here, feel free to take it.

jQuery Scoped CSS plugin

This adds support for the scoped attribute to limit a block of style declarations to a specific area of the HTML. You can also use @import and media filters in scoped blocks.

Use

Include this plugin file (minified, ideally) and call $.scoped() on load. If you add style blocks to the page later, you need to rerun the plugin.

Any style blocks with the scoped attribute are processed and limited to only affect their parent's children:

<p>This will be black.</p>
<section>
 <style scoped>
   p {color:red;}
 </style> 
 <p>This will be red.</p>
</section>

Limitations

  • If you're using multiple nested declarations, Webkit might apply different inheritance specificity rules from the other engines. I don't know who's right.
  • Remember, IE < 9 support requires a helping hand if you're using HTML 5 elements
  • Currently, getElementStyles is hand-rolled and possibly wrong.
  • Sometimes there are delays parsing externally loaded stylesheets (via @import) and they might get skipped. Not often but it happens.

Notes

  • If the browser natively supports style scoped, this will return without doing anything
  • Style elements really shouldn't have classes added to them. This bit of the functionality should probably use some kind of data attribute.
  • The scoped blocks are emptied out for non-IE browsers because currently only IE supports the 'disabled' attribute.
  • Opera exhibits a short delay (~20ms) when resolving styles included via @import. There's a forced delay to counter this.
  • Opera seems to add an extra content:none on text nodes.

More Repositories

1

Hardy

Selenium-driven, cucumber-powered CSS testing.
JavaScript
320
star
2

devtools-extension

Basic example of a Chrome Devtools extension with communication between the inspected page and the panel
JavaScript
222
star
3

csstest

NOT MAINTAINED: A collection of resources on automated CSS testing
HTML
101
star
4

cssert

DEPRECATED: CSS verification testing
JavaScript
32
star
5

jQTouch-Calendar

DEPRECATED: Calendar Extension for jQTouch
CSS
17
star
6

Transmission.bundle

Python
15
star
7

opensourcesnacks

Collection of open-source snack recipes
HTML
9
star
8

8bitalpha

Web Service to convert 24bit PNGs into 8bit PNGs while maintaining the alpha channel
JavaScript
7
star
9

pushbolig

DEPRECATED: Very basic integration of boligportal.dk apartment search with pushbullet.com notifications.
JavaScript
6
star
10

AppCMS

Drupal 6 theme and modules to create a flattened site that can be embedded in PhoneGap
JavaScript
5
star
11

coordinate-tz

Node module to map latitude/longitude to an IANA timezone
JavaScript
5
star
12

map-playground

Map Playground for jHERE
HTML
4
star
13

Cobalt.vim

(Yet another) port of the Cobalt colorscheme to Vim
Vim Script
4
star
14

Proximity

Proximity search API.
JavaScript
3
star
15

GrowlBird

A plugin to send Growl notifications to a Twitter account
Objective-C
3
star
16

CodeExamples

Example code for a tutorial on the Web Audio API presented at a Nokia Tech Talk
JavaScript
3
star
17

HashtagHeatmap

Display density for tweets on a Nokia map
JavaScript
2
star
18

TweetArchiver

Searches Twitter for a specified hashtag and saves, caches and displays the results. Source code for http://memories.museum140.com/
PHP
2
star
19

here-map

Web Component to embed a HERE map
JavaScript
2
star
20

sponsored-event

Managed sponsored events through an Ethereum smart contract
Vue
2
star
21

scrimshaw

Bare-bones API tests using cURL
Shell
2
star
22

SeadragonHotspots

Enabling hotspots on the AJAX version of Microsoft's Seadragon
JavaScript
2
star
23

Knot

Multi-touch knot tying and untying game
JavaScript
2
star
24

hardy.io

Website for Hardy
CSS
1
star
25

winterwiki

Test Repo for messing around with the wiki API
Shell
1
star
26

GhostKnife

A little PhantomJS helper script to slice up page renders
JavaScript
1
star
27

CoverMapMe

Source of the website http://covermap.me/
PHP
1
star
28

planets-api

Simple REST API that returns altitude and azimuth for planets
JavaScript
1
star
29

HighlightBlock.vim

Vim plugin to highlight CSS and JS blocks in html with a full line highlight
Vim Script
1
star