repos
/
Oh, Ducks!
/ annotate_shade
summary
|
shortlog
|
log
|
tree
|
commit
|
commitdiff
|
headdiff
|
annotate
|
headblob
|
headfilediff
|
filehistory
normal
|
plain
|
shade
|
zebra
Return NIL if attribute was not present
Annotate for file /traversal/dom.lisp
2009-11-18 pix
1
(in-package #:oh-ducks.traversal)
2009-11-18 pix
2
2009-11-23 pix
3
(defmethod unify::occurs-in-p ((var symbol) (pat dom:element) env)
2009-12-03 pix
4
(declare (ignore var pat env))
2009-11-23 pix
5
nil)
11:54:01 '
6
2009-12-05 pix
7
(defmethod unify:unify ((template oh-ducks::css-selector-template)
07:23:38 '
8
(document dom:document)
'
9
&optional (env (unify:make-empty-environment))
2010-01-04 pix
10
&key)
2009-12-05 pix
11
(unify:unify template (dom:document-element document) env))
07:23:38 '
12
2009-11-18 pix
13
;;; general accessors
08:57:44 '
14
2009-11-21 pix
15
(defmethod element-children ((element dom:element))
16:12:13 '
16
(remove-if-not #'dom:element-p (coerce (dom:child-nodes element) 'list)))
2009-11-23 pix
17
2009-11-21 pix
18
(defmethod element-parent ((element dom:element))
2009-11-23 pix
19
(let ((parent (dom:parent-node element)))
11:36:20 '
20
(unless (typep parent 'dom:document)
'
21
parent)))
2009-11-23 pix
22
2009-11-18 pix
23
(defmethod element-attribute ((attribute symbol) (element dom:element))
08:57:44 '
24
(element-attribute (string-downcase (symbol-name attribute)) element))
'
25
(defmethod element-attribute ((attribute string) (element dom:element))
2010-02-10 pix
26
(when-let* ((attribute-node (dom:get-attribute-node element attribute)))
08:20:45 '
27
(dom:value attribute-node)))
2009-11-23 pix
28
2009-11-18 pix
29
(defmethod element-type ((element dom:element))
08:57:44 '
30
(dom:tag-name element))
'
31
2009-12-13 pix
32
(defmethod element-content ((element dom:element))
05:24:52 '
33
(mapcar (lambda (node)
'
34
(typecase node
'
35
(dom:element node)
'
36
(dom:text (dom:data node))
'
37
(t (error "Unsure what to do."))))
'
38
(coerce (dom:child-nodes element) 'list)))
'
39
2009-11-18 pix
40
;;; special accessors in case something special needs to happen
08:57:44 '
41
(defmethod element-id ((element dom:element))
'
42
(element-attribute "id" element))
'
43
2009-11-23 pix
44
(defmethod element-classes ((element dom:element))
2009-11-18 pix
45
(split-sequence:split-sequence #\Space (element-attribute "class" element) :remove-empty-subseqs t))