Skip to content
This repository has been archived by the owner on Nov 17, 2021. It is now read-only.

Commit

Permalink
fix(Utility functions): Allow for camelCase property names
Browse files Browse the repository at this point in the history
  • Loading branch information
nokome committed Feb 26, 2020
1 parent eddec64 commit e7a673b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/util/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,14 @@ export function create(
} else {
// Create from CSS selector
// Translate semantic selectors to attribute selectors
// 1. Type selectors (need itemscope attr too)
spec = spec.replace(
/:--[A-Z][a-z]+/g,
typeSelector => `[itemscope] ${translate(typeSelector)}`
)
spec = spec.replace(/:--[a-z]+/g, translate)
// 2. Prop selectors
spec = spec.replace(/:--[a-zA-Z]+/g, translate)

// Credit to https://github.com/hekigan/dom-create-element-query-selector
// for the regexes (with some modifications).
const tag = /^[a-z0-9]+/i.exec(spec)?.[0] ?? 'div'
Expand Down

0 comments on commit e7a673b

Please sign in to comment.