Results 1 to 5 of 5

Threaded View

  1. #1

    Thread Starter
    Stack Overflow mod​erator
    Join Date
    May 2008
    British Columbia, Canada

    Smile [JQuery] Syntactic Sugar JavaScript library

    Recent Changes
    1. Update to v0.8 Critical bug fixes.
    2. Update to v0.7 Bug fixes and more extensions.

    This is my first shot at a JavaScript library, it includes support for:
    • CSS1 Selectors (By tag name, class name, ID, and parent node trees, although that's a bit different)
    • CSS3 Pseudo-classes
    • Multi-element CSS changes
    • Animation (multiple elements, too!)
    • Additional extensions

    The CSS1 selectors are a bit different when dealing with ancestor-of selectors. Normally, in CSS, "div p" would be any <p> element under a <div> element. In Syntactic Sugar, it must be a direct child (equivalent to "div > p" in CSS). This is because I found it too complicated and unnecessary to include the relationship selectors (*: general sibling, >: direct child, <: direct parent, ~: general sibling, +: adjacent sibling). If you find it necessary, let me know - I'll move it up on the priority list. I'm working on it.

    Here's a syntax example. It takes all <div> elements that are the last <div> element in their parent element that also have the class "blue" but not the class "dontstyle" and colors them blue and italicizes them:

    One known bug is that the nth-child, nth-last-child, nth-of-type, and nth-last-of-type selectors do not work with expressions, such as ":nth-last-child(2n+3)". Once again, working on it.

    Please enjoy this library and let me know about any bugs, or any features you want added. Attached are the main library, the animation extensions, and an example HTML file. The example HTML is example.txt (VBForums doesn't let you upload HTML files directly) and contains both scripts so people who just want to see what it's like don't have to download a whole ZIP file.
    Attached Files Attached Files
    Last edited by minitech; Feb 21st, 2011 at 03:34 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts


Click Here to Expand Forum to Full Width

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.