Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 929453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:10:26+00:00 2026-05-15T20:10:26+00:00

I’m attempting to write my first jQuery plugin to query multi-dimensional arrays of complex

  • 0

I’m attempting to write my first jQuery plugin to query multi-dimensional arrays of complex objects. It kind of functions how I want it, but right now it receives a property name and value as input for comparison of the items. I want to modify it so that it can receive jQuery’s selector syntax as input in order to filter my objects in a more encompassing manner.

I want to be able to provide syntax the same as or similar to jquery’s ‘native’ selector syntax:

"string"
"number"
"boolean"
"object"
"string,number,boolean"
"object[FirstName='Ben'][LastName='Alabaster']"
"object[LastName^='Ala']"
"object[LastName$='er']"

etc.

Are there any tutorials or plugins that demonstrate this ability to parse selector syntax for comparing against objects?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T20:10:27+00:00Added an answer on May 15, 2026 at 8:10 pm

    The selector syntax that jQuery uses was abstracted into the Sizzle library. you can view the source to Sizzle on GitHub.

    Sizzle is pretty clearly customized to query against a document’s Document Object Model, so you’d be doing modifications to get it to query against other kinds of data. Have a look at lines 294 to 303:

    match: {
        ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
        CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
        NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,
        ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
        TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
        CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+\-]*)\))?/,
        POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
        PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
    },
    

    And here’s code that appears to parse attribute selectors like ^= and ~=, lines 661 to 691:

    ATTR: function(elem, match){
        var name = match[1],
            result = Expr.attrHandle[ name ] ?
                Expr.attrHandle[ name ]( elem ) :
                elem[ name ] != null ?
                    elem[ name ] :
                    elem.getAttribute( name ),
            value = result + "",
            type = match[2],
            check = match[4];
    
        return result == null ?
            type === "!=" :
            type === "=" ?
            value === check :
            type === "*=" ?
            value.indexOf(check) >= 0 :
            type === "~=" ?
            (" " + value + " ").indexOf(check) >= 0 :
            !check ?
            value && result !== false :
            type === "!=" ?
            value !== check :
            type === "^=" ?
            value.indexOf(check) === 0 :
            type === "$=" ?
            value.substr(value.length - check.length) === check :
            type === "|=" ?
            value === check || value.substr(0, check.length + 1) === check + "-" :
            false;
    },
    

    The way these regular expressions and logic are used may give you ideas as to how to implement your data structure queries.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.