|
@@ -99,6 +99,20 @@ func (s *Selection) Html() (ret string, e error) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+func (s *Selection) OuterHtml() (ret string, e error) {
|
|
|
|
+ // Since there is no .innerHtml, the HTML content must be re-created from
|
|
|
|
+ // the nodes using html.Render.
|
|
|
|
+ var buf bytes.Buffer
|
|
|
|
+ if len(s.Nodes) > 0 {
|
|
|
|
+ e = html.Render(&buf, s.Nodes[0])
|
|
|
|
+ if e != nil {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ ret = buf.String()
|
|
|
|
+ }
|
|
|
|
+ return
|
|
|
|
+}
|
|
|
|
+
|
|
// AddClass adds the given class(es) to each element in the set of matched elements.
|
|
// AddClass adds the given class(es) to each element in the set of matched elements.
|
|
// Multiple class names can be specified, separated by a space or via multiple arguments.
|
|
// Multiple class names can be specified, separated by a space or via multiple arguments.
|
|
func (s *Selection) AddClass(class ...string) *Selection {
|
|
func (s *Selection) AddClass(class ...string) *Selection {
|