Skip to content

Commit

Permalink
docs(hiccup-css): add doc strings for attrib fns
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Mar 5, 2018
1 parent 721583a commit 22bc29c
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions packages/hiccup-css/src/attribs.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,52 @@
const $ = (op) => (id: string, x: string | number, caseSensitve = false) => `[${id}${op}="${x}"${caseSensitve ? " i" : ""}]`;

/**
* Returns attrib selector: `[id]`
*
* @param id
*/
export const withAttrib = (id: string) => `[${id}]`;

/**
* Returns attrib selector `[id=x]`
*
* @param id
* @param x
* @param caseSensitive
*/
export const attribEq = $("");

/**
* Returns attrib selector `[id~=x]`
*
* @param id
* @param x
* @param caseSensitive
*/
export const attribContains = $("~");

/**
* Returns attrib selector `[id^=x]`
*
* @param id
* @param x
* @param caseSensitive
*/
export const attribPrefix = $("^");

/**
* Returns attrib selector `[id$=x]`
*
* @param id
* @param x
* @param caseSensitive
*/
export const attribSuffix = $("$");

/**
* Returns attrib selector `[id*=x]`
* @param id
* @param x
* @param caseSensitive
*/
export const attribMatches = $("*");

0 comments on commit 22bc29c

Please sign in to comment.