Moar CSS selectors, fewer explicit lambdas
Thu Nov 19 06:25:36 UTC 2009 pix@kepibu.org
* Moar CSS selectors, fewer explicit lambdas
hunk ./notes 6
-*** :nth-child
-*** :first-child
-*** :last-child
-*** universal selector (*)
+*** positional selectors
+ * [ ] :nth-child
+ * [ ] :nth-last-child
+ * [ ] :first-child
+ * [ ] :last-child
+ * [ ] :nth-of-type
+ * [ ] :nth-last-of-type
+ * [ ] :first-of-type
+ * [ ] :last-of-type
+ * [ ] :only-child
+ * [ ] :only-of-type
+ * [ ] :empty
+*** attribute selectors
+ * [ ] attribute-present [att]
+ * [ ] attribute-equal [att=val]
+ * [ ] attribute-member [att~=val]
+ * [ ] attribute-lang [att|=val]
+ * [ ] attribute-begins [att^=val]
+ * [ ] attribute-ends [att$=val]
+ * [ ] attribute-contains [att*=val]
+*** :not(...)
hunk ./notes 28
+** namespace support(?)
hunk ./oh-ducks.asd 23
- :depends-on (:cl-unification :cl-ppcre :split-sequence)
+ :depends-on (:cl-unification :cl-ppcre :split-sequence :alexandria)
hunk ./package.lisp 15
+ (:import-from #:alexandria
+ #:compose
+ #:curry
+ #:rcurry)
hunk ./selectors.lisp 32
-#+FIXME ; is this the right name?
hunk ./selectors.lisp 45
+ #+TODO (#T(regexp$ "[ ]*[~][ ]*" ()) (list (make-instance 'sibling-combinator :matcher (parse-selector &rest))))
+ #+TODO (#T(regexp$ "[ ]*[+][ ]*" ()) (list (make-instance 'adjacent-combinator :matcher (parse-selector &rest))))
hunk ./selectors.lisp 53
- #+TODO
hunk ./selectors.lisp 59
- (remove-if-not (lambda (el) (element-matches-p el selector)) elements)
+ (remove-if-not (rcurry #'element-matches-p selector) elements)
hunk ./selectors.lisp 61
- (remove-if #'null
- (mapcar (lambda (element) (find-matching-elements selector (element-children element)))
- elements)))))
+ (mapcar (compose (curry #'find-matching-elements selector) #'element-children)
+ elements))))
hunk ./selectors.lisp 80
+(defmethod element-matches-p (element (selector universal-selector))
+ t)
+
hunk ./selectors.lisp 84
- (every (lambda (s) (element-matches-p element s)) selector))
+ (every (curry #'element-matches-p element) selector))
hunk ./selectors.lisp 90
- (some (lambda (a) (element-matches-p a (matcher selector))) (element-ancestors element)))
+ (some (rcurry #'element-matches-p (matcher selector)) (element-ancestors element)))
+
+#+TODO
+(defmethod element-matches-p (element (selector adjacent-combinator))
+ ...)
+
+#+TODO
+(defmethod element-matches-p (element (selector sibling-combinator))
+ ...)
hunk ./templates.lisp 26
+ (declare (ignore parser spec))