Skip to content

Commit

Permalink
Add some missing API docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
rgrove committed Apr 18, 2015
1 parent ad582fb commit b48e9f5
Showing 1 changed file with 52 additions and 1 deletion.
53 changes: 52 additions & 1 deletion lib/sanitize/css.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,50 @@ def self.properties(css, config = {})
self.new(config).properties(css)
end

# Sanitizes a full CSS stylesheet.
#
# A stylesheet may include selectors, at-rules, and comments. To sanitize only
# inline style properties such as the contents of an HTML `style` attribute,
# use {.properties}.
#
# @example
# css = %[
# .foo {
# background: url(foo.png);
# color: #fff;
# }
#
# #bar {
# font: 42pt 'Comic Sans MS';
# }
# ]
#
# Sanitize::CSS.stylesheet(css, Sanitize::Config::RELAXED)
#
# @return [String] Sanitized CSS stylesheet.
def self.stylesheet(css, config = {})
self.new(config).stylesheet(css)
end

# Sanitizes the given Crass CSS parse tree and all its children, modifying it
# in place.
#
# @example
# css = %[
# .foo {
# background: url(foo.png);
# color: #fff;
# }
#
# #bar {
# font: 42pt 'Comic Sans MS';
# }
# ]
#
# tree = Crass.parse(css)
# Sanitize::CSS.tree!(tree, Sanitize::Config::RELAXED)
#
# @return [Array] Sanitized Crass CSS parse tree.
def self.tree!(tree, config = {})
self.new(config).tree!(tree)
end
Expand Down Expand Up @@ -65,7 +105,7 @@ def properties(css)

# Sanitizes a full CSS stylesheet.
#
# A stylesheet may include selectors, @ rules, and comments. To sanitize only
# A stylesheet may include selectors, at-rules, and comments. To sanitize only
# inline style properties such as the contents of an HTML `style` attribute,
# use {#properties}.
#
Expand Down Expand Up @@ -98,6 +138,17 @@ def stylesheet(css)
# in place.
#
# @example
# css = %[
# .foo {
# background: url(foo.png);
# color: #fff;
# }
#
# #bar {
# font: 42pt 'Comic Sans MS';
# }
# ]
#
# scss = Sanitize::CSS.new(Sanitize::Config::RELAXED)
# tree = Crass.parse(css)
#
Expand Down

0 comments on commit b48e9f5

Please sign in to comment.