diff --git a/test/test-web.lisp b/test/test-web.lisp
index 919d216..cb5b9a3 100644
--- a/test/test-web.lisp
+++ b/test/test-web.lisp
@@ -46,7 +46,9 @@
"Link to example.com"))
(format nil
"Link to example.com")))
+ class=\"demo-link plain\">Link to example.com"))
+ (== (dom:render (dom:br nil))
+ (format nil "
")))
(deftest test-jwt ()
(let ((secret (crypt:create-secret))
diff --git a/web/dom.lisp b/web/dom.lisp
index 593d89c..106f0b1 100644
--- a/web/dom.lisp
+++ b/web/dom.lisp
@@ -31,7 +31,7 @@
(make-instance 'xml-element :tag tag :attrs attrs :body body))
(defmethod put ((el xml-element))
- (let ((tag (string-downcase (tag el)))
+ (let ((tag (tagname el))
(body (body el)))
(start tag (attrs el) :close (not body))
(when body
@@ -39,12 +39,15 @@
(put c))
(end tag))))
+(defgeneric tagname (el)
+ (:method ((el xml-element)) (string-downcase (tag el))))
+
;;;; element = HTML element - no self-closing of empty elements
(defclass element (xml-element) ())
(defmethod put ((el element))
- (let ((tag (string-downcase (tag el))))
+ (let ((tag (tagname el)))
(start tag (attrs el))
(dolist (c (body el))
(put c))
@@ -60,11 +63,11 @@
(defclass void-element (xml-element) ())
-(defun void-element (tag attrs)
+(defun void-element (tag &optional attrs body)
(make-instance 'void-element :tag tag :attrs attrs))
(defmethod put ((el void-element))
- (start (tag el) (attrs el)))
+ (start (tagname el) (attrs el)))
;;;; automatically define standard HTML elements
@@ -79,7 +82,7 @@
(make-elements (a dd div dl dt label)))
(eval-when (:compile-toplevel :load-toplevel :execute)
- (make-elements (br input) :void-element))
+ (make-elements (br input) void-element))
;;;; elements with specific functionality