1 <?xml version="1.0" encoding="ascii"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3 "DTD/xhtml1-transitional.dtd">
4 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6 <title>lxml.html.clean.Cleaner</title>
7 <link rel="stylesheet" href="epydoc.css" type="text/css" />
8 <script type="text/javascript" src="epydoc.js"></script>
11 <body bgcolor="white" text="black" link="blue" vlink="#204080"
13 <!-- ==================== NAVIGATION BAR ==================== -->
14 <table class="navbar" border="0" width="100%" cellpadding="0"
15 bgcolor="#a0c0ff" cellspacing="0">
18 <th> <a
19 href="lxml-module.html">Home</a> </th>
22 <th> <a
23 href="module-tree.html">Trees</a> </th>
26 <th> <a
27 href="identifier-index.html">Indices</a> </th>
30 <th> <a
31 href="help.html">Help</a> </th>
33 <!-- Project homepage -->
34 <th class="navbar" align="right" width="100%">
35 <table border="0" cellpadding="0" cellspacing="0">
36 <tr><th class="navbar" align="center"
37 ><a class="navbar" target="_top" href="/">lxml API</a></th>
41 <table width="100%" cellpadding="0" cellspacing="0">
44 <span class="breadcrumbs">
45 <a href="lxml-module.html">Package lxml</a> ::
46 <a href="lxml.html-module.html">Package html</a> ::
47 <a href="lxml.html.clean-module.html">Module clean</a> ::
52 <table cellpadding="0" cellspacing="0">
53 <!-- hide/show private -->
54 <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
55 onclick="toggle_private();">hide private</a>]</span></td></tr>
56 <tr><td align="right"><span class="options"
57 >[<a href="frames.html" target="_top">frames</a
58 >] | <a href="lxml.html.clean.Cleaner-class.html"
59 target="_top">no frames</a>]</span></td></tr>
64 <!-- ==================== CLASS DESCRIPTION ==================== -->
65 <h1 class="epydoc">Class Cleaner</h1><p class="nomargin-top"><span class="codelink"><a href="lxml.html.clean-pysrc.html#Cleaner">source code</a></span></p>
66 <pre class="base-tree">
69 <strong class="uidshort">Cleaner</strong>
73 <p>Instances cleans the document of each of the possible offending
74 elements. The cleaning is controlled by attributes; you can
75 override attributes in a subclass, or set them in the constructor.</p>
76 <dl class="rst-docutils">
77 <dt><tt class="rst-docutils literal">scripts</tt>:</dt>
78 <dd>Removes any <tt class="rst-docutils literal"><script></tt> tags.</dd>
79 <dt><tt class="rst-docutils literal">javascript</tt>:</dt>
80 <dd>Removes any Javascript, like an <tt class="rst-docutils literal">onclick</tt> attribute.</dd>
81 <dt><tt class="rst-docutils literal">comments</tt>:</dt>
82 <dd>Removes any comments.</dd>
83 <dt><tt class="rst-docutils literal">style</tt>:</dt>
84 <dd>Removes any style tags or attributes.</dd>
85 <dt><tt class="rst-docutils literal">links</tt>:</dt>
86 <dd>Removes any <tt class="rst-docutils literal"><link></tt> tags</dd>
87 <dt><tt class="rst-docutils literal">meta</tt>:</dt>
88 <dd>Removes any <tt class="rst-docutils literal"><meta></tt> tags</dd>
89 <dt><tt class="rst-docutils literal">page_structure</tt>:</dt>
90 <dd>Structural parts of a page: <tt class="rst-docutils literal"><head></tt>, <tt class="rst-docutils literal"><html></tt>, <tt class="rst-docutils literal"><title></tt>.</dd>
91 <dt><tt class="rst-docutils literal">processing_instructions</tt>:</dt>
92 <dd>Removes any processing instructions.</dd>
93 <dt><tt class="rst-docutils literal">embedded</tt>:</dt>
94 <dd>Removes any embedded objects (flash, iframes)</dd>
95 <dt><tt class="rst-docutils literal">frames</tt>:</dt>
96 <dd>Removes any frame-related tags</dd>
97 <dt><tt class="rst-docutils literal">forms</tt>:</dt>
98 <dd>Removes any form tags</dd>
99 <dt><tt class="rst-docutils literal">annoying_tags</tt>:</dt>
100 <dd>Tags that aren't <em>wrong</em>, but are annoying. <tt class="rst-docutils literal"><blink></tt> and <tt class="rst-docutils literal"><marquee></tt></dd>
101 <dt><tt class="rst-docutils literal">remove_tags</tt>:</dt>
102 <dd>A list of tags to remove. Only the tags will be removed,
103 their content will get pulled up into the parent tag.</dd>
104 <dt><tt class="rst-docutils literal">kill_tags</tt>:</dt>
105 <dd>A list of tags to kill. Killing also removes the tag's content,
106 i.e. the whole subtree, not just the tag itself.</dd>
107 <dt><tt class="rst-docutils literal">allow_tags</tt>:</dt>
108 <dd>A list of tags to include (default include all).</dd>
109 <dt><tt class="rst-docutils literal">remove_unknown_tags</tt>:</dt>
110 <dd>Remove any tags that aren't standard parts of HTML.</dd>
111 <dt><tt class="rst-docutils literal">safe_attrs_only</tt>:</dt>
112 <dd>If true, only include 'safe' attributes (specifically the list
113 from <a class="rst-reference external" href="http://feedparser.org/docs/html-sanitization.html" target="_top">feedparser</a>).</dd>
114 <dt><tt class="rst-docutils literal">add_nofollow</tt>:</dt>
115 <dd>If true, then any <a> tags will have <tt class="rst-docutils literal"><span class="pre">rel="nofollow"</span></tt> added to them.</dd>
116 <dt><tt class="rst-docutils literal">host_whitelist</tt>:</dt>
117 <dd><p class="rst-first">A list or set of hosts that you can use for embedded content
118 (for content like <tt class="rst-docutils literal"><object></tt>, <tt class="rst-docutils literal"><link <span class="pre">rel="stylesheet"></span></tt>, etc).
119 You can also implement/override the method
120 <tt class="rst-docutils literal">allow_embedded_url(el, url)</tt> or <tt class="rst-docutils literal">allow_element(el)</tt> to
121 implement more complex rules for what can be embedded.
122 Anything that passes this test will be shown, regardless of
123 the value of (for instance) <tt class="rst-docutils literal">embedded</tt>.</p>
124 <p class="rst-last">Note that this parameter might not work as intended if you do not
125 make the links absolute before doing the cleaning.</p>
127 <dt><tt class="rst-docutils literal">whitelist_tags</tt>:</dt>
128 <dd>A set of tags that can be included with <tt class="rst-docutils literal">host_whitelist</tt>.
129 The default is <tt class="rst-docutils literal">iframe</tt> and <tt class="rst-docutils literal">embed</tt>; you may wish to
130 include other tags like <tt class="rst-docutils literal">script</tt>, or you may want to
131 implement <tt class="rst-docutils literal">allow_embedded_url</tt> for more control. Set to None to
132 include all tags.</dd>
134 <p>This modifies the document <em>in place</em>.</p>
136 <!-- ==================== INSTANCE METHODS ==================== -->
137 <a name="section-InstanceMethods"></a>
138 <table class="summary" border="1" cellpadding="3"
139 cellspacing="0" width="100%" bgcolor="white">
140 <tr bgcolor="#70b0f0" class="table-header">
141 <td colspan="2" class="table-header">
142 <table border="0" cellpadding="0" cellspacing="0" width="100%">
144 <td align="left"><span class="table-header">Instance Methods</span></td>
145 <td align="right" valign="top"
146 ><span class="options">[<a href="#section-InstanceMethods"
147 class="privatelink" onclick="toggle_private();"
148 >hide private</a>]</span></td>
154 <td width="15%" align="right" valign="top" class="summary">
155 <span class="summary-type"> </span>
156 </td><td class="summary">
157 <table width="100%" cellpadding="0" cellspacing="0" border="0">
159 <td><span class="summary-sig"><a href="lxml.html.clean.Cleaner-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary-sig-arg">self</span>,
160 <span class="summary-sig-arg">**kw</span>)</span><br />
161 x.__init__(...) initializes x; see help(type(x)) for signature</td>
162 <td align="right" valign="top">
163 <span class="codelink"><a href="lxml.html.clean-pysrc.html#Cleaner.__init__">source code</a></span>
172 <td width="15%" align="right" valign="top" class="summary">
173 <span class="summary-type"> </span>
174 </td><td class="summary">
175 <table width="100%" cellpadding="0" cellspacing="0" border="0">
177 <td><span class="summary-sig"><a name="__call__"></a><span class="summary-sig-name">__call__</span>(<span class="summary-sig-arg">self</span>,
178 <span class="summary-sig-arg">doc</span>)</span><br />
179 Cleans the document.</td>
180 <td align="right" valign="top">
181 <span class="codelink"><a href="lxml.html.clean-pysrc.html#Cleaner.__call__">source code</a></span>
190 <td width="15%" align="right" valign="top" class="summary">
191 <span class="summary-type"> </span>
192 </td><td class="summary">
193 <table width="100%" cellpadding="0" cellspacing="0" border="0">
195 <td><span class="summary-sig"><a name="allow_follow"></a><span class="summary-sig-name">allow_follow</span>(<span class="summary-sig-arg">self</span>,
196 <span class="summary-sig-arg">anchor</span>)</span><br />
197 Override to suppress rel="nofollow" on some anchors.</td>
198 <td align="right" valign="top">
199 <span class="codelink"><a href="lxml.html.clean-pysrc.html#Cleaner.allow_follow">source code</a></span>
208 <td width="15%" align="right" valign="top" class="summary">
209 <span class="summary-type"> </span>
210 </td><td class="summary">
211 <table width="100%" cellpadding="0" cellspacing="0" border="0">
213 <td><span class="summary-sig"><a name="allow_element"></a><span class="summary-sig-name">allow_element</span>(<span class="summary-sig-arg">self</span>,
214 <span class="summary-sig-arg">el</span>)</span></td>
215 <td align="right" valign="top">
216 <span class="codelink"><a href="lxml.html.clean-pysrc.html#Cleaner.allow_element">source code</a></span>
225 <td width="15%" align="right" valign="top" class="summary">
226 <span class="summary-type"> </span>
227 </td><td class="summary">
228 <table width="100%" cellpadding="0" cellspacing="0" border="0">
230 <td><span class="summary-sig"><a name="allow_embedded_url"></a><span class="summary-sig-name">allow_embedded_url</span>(<span class="summary-sig-arg">self</span>,
231 <span class="summary-sig-arg">el</span>,
232 <span class="summary-sig-arg">url</span>)</span></td>
233 <td align="right" valign="top">
234 <span class="codelink"><a href="lxml.html.clean-pysrc.html#Cleaner.allow_embedded_url">source code</a></span>
243 <td width="15%" align="right" valign="top" class="summary">
244 <span class="summary-type"> </span>
245 </td><td class="summary">
246 <table width="100%" cellpadding="0" cellspacing="0" border="0">
248 <td><span class="summary-sig"><a name="kill_conditional_comments"></a><span class="summary-sig-name">kill_conditional_comments</span>(<span class="summary-sig-arg">self</span>,
249 <span class="summary-sig-arg">doc</span>)</span><br />
250 IE conditional comments basically embed HTML that the parser
251 doesn't normally see. We can't allow anything like that, so
252 we'll kill any comments that could be conditional.</td>
253 <td align="right" valign="top">
254 <span class="codelink"><a href="lxml.html.clean-pysrc.html#Cleaner.kill_conditional_comments">source code</a></span>
263 <td width="15%" align="right" valign="top" class="summary">
264 <span class="summary-type"> </span>
265 </td><td class="summary">
266 <table width="100%" cellpadding="0" cellspacing="0" border="0">
268 <td><span class="summary-sig"><a name="_kill_elements"></a><span class="summary-sig-name">_kill_elements</span>(<span class="summary-sig-arg">self</span>,
269 <span class="summary-sig-arg">doc</span>,
270 <span class="summary-sig-arg">condition</span>,
271 <span class="summary-sig-arg">iterate</span>=<span class="summary-sig-default">None</span>)</span></td>
272 <td align="right" valign="top">
273 <span class="codelink"><a href="lxml.html.clean-pysrc.html#Cleaner._kill_elements">source code</a></span>
282 <td width="15%" align="right" valign="top" class="summary">
283 <span class="summary-type"> </span>
284 </td><td class="summary">
285 <table width="100%" cellpadding="0" cellspacing="0" border="0">
287 <td><span class="summary-sig"><a name="_remove_javascript_link"></a><span class="summary-sig-name">_remove_javascript_link</span>(<span class="summary-sig-arg">self</span>,
288 <span class="summary-sig-arg">link</span>)</span></td>
289 <td align="right" valign="top">
290 <span class="codelink"><a href="lxml.html.clean-pysrc.html#Cleaner._remove_javascript_link">source code</a></span>
299 <td width="15%" align="right" valign="top" class="summary">
300 <span class="summary-type"> </span>
301 </td><td class="summary">
302 <table width="100%" cellpadding="0" cellspacing="0" border="0">
304 <td><span class="summary-sig"><a name="_substitute_comments"></a><span class="summary-sig-name">_substitute_comments</span>(<span class="summary-sig-arg">...</span>)</span><br />
305 sub(repl, string[, count = 0]) --> newstring
306 Return the string obtained by replacing the leftmost non-overlapping
307 occurrences of pattern in string by the replacement repl.</td>
308 <td align="right" valign="top">
309 <span class="codelink"><a href="lxml.html.clean-pysrc.html#Cleaner._substitute_comments">source code</a></span>
318 <td width="15%" align="right" valign="top" class="summary">
319 <span class="summary-type"> </span>
320 </td><td class="summary">
321 <table width="100%" cellpadding="0" cellspacing="0" border="0">
323 <td><span class="summary-sig"><a href="lxml.html.clean.Cleaner-class.html#_has_sneaky_javascript" class="summary-sig-name" onclick="show_private();">_has_sneaky_javascript</a>(<span class="summary-sig-arg">self</span>,
324 <span class="summary-sig-arg">style</span>)</span><br />
325 Depending on the browser, stuff like <tt class="rst-docutils literal">e x p r e s s i o <span class="pre">n(...)</span></tt>
326 can get interpreted, or <tt class="rst-docutils literal">expre/* stuff <span class="pre">*/ssion(...)</span></tt>. This
327 checks for attempt to do stuff like this.</td>
328 <td align="right" valign="top">
329 <span class="codelink"><a href="lxml.html.clean-pysrc.html#Cleaner._has_sneaky_javascript">source code</a></span>
338 <td width="15%" align="right" valign="top" class="summary">
339 <span class="summary-type"> </span>
340 </td><td class="summary">
341 <table width="100%" cellpadding="0" cellspacing="0" border="0">
343 <td><span class="summary-sig"><a name="clean_html"></a><span class="summary-sig-name">clean_html</span>(<span class="summary-sig-arg">self</span>,
344 <span class="summary-sig-arg">html</span>)</span></td>
345 <td align="right" valign="top">
346 <span class="codelink"><a href="lxml.html.clean-pysrc.html#Cleaner.clean_html">source code</a></span>
355 <td colspan="2" class="summary">
356 <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
357 <code>__delattr__</code>,
358 <code>__format__</code>,
359 <code>__getattribute__</code>,
360 <code>__hash__</code>,
361 <code>__new__</code>,
362 <code>__reduce__</code>,
363 <code>__reduce_ex__</code>,
364 <code>__repr__</code>,
365 <code>__setattr__</code>,
366 <code>__sizeof__</code>,
367 <code>__str__</code>,
368 <code>__subclasshook__</code>
373 <!-- ==================== CLASS VARIABLES ==================== -->
374 <a name="section-ClassVariables"></a>
375 <table class="summary" border="1" cellpadding="3"
376 cellspacing="0" width="100%" bgcolor="white">
377 <tr bgcolor="#70b0f0" class="table-header">
378 <td colspan="2" class="table-header">
379 <table border="0" cellpadding="0" cellspacing="0" width="100%">
381 <td align="left"><span class="table-header">Class Variables</span></td>
382 <td align="right" valign="top"
383 ><span class="options">[<a href="#section-ClassVariables"
384 class="privatelink" onclick="toggle_private();"
385 >hide private</a>]</span></td>
391 <td width="15%" align="right" valign="top" class="summary">
392 <span class="summary-type"> </span>
393 </td><td class="summary">
394 <a name="scripts"></a><span class="summary-name">scripts</span> = <code title="True">True</code>
398 <td width="15%" align="right" valign="top" class="summary">
399 <span class="summary-type"> </span>
400 </td><td class="summary">
401 <a name="javascript"></a><span class="summary-name">javascript</span> = <code title="True">True</code>
405 <td width="15%" align="right" valign="top" class="summary">
406 <span class="summary-type"> </span>
407 </td><td class="summary">
408 <a name="comments"></a><span class="summary-name">comments</span> = <code title="True">True</code>
412 <td width="15%" align="right" valign="top" class="summary">
413 <span class="summary-type"> </span>
414 </td><td class="summary">
415 <a name="style"></a><span class="summary-name">style</span> = <code title="False">False</code>
419 <td width="15%" align="right" valign="top" class="summary">
420 <span class="summary-type"> </span>
421 </td><td class="summary">
422 <a name="links"></a><span class="summary-name">links</span> = <code title="True">True</code>
426 <td width="15%" align="right" valign="top" class="summary">
427 <span class="summary-type"> </span>
428 </td><td class="summary">
429 <a name="meta"></a><span class="summary-name">meta</span> = <code title="True">True</code>
433 <td width="15%" align="right" valign="top" class="summary">
434 <span class="summary-type"> </span>
435 </td><td class="summary">
436 <a name="page_structure"></a><span class="summary-name">page_structure</span> = <code title="True">True</code>
440 <td width="15%" align="right" valign="top" class="summary">
441 <span class="summary-type"> </span>
442 </td><td class="summary">
443 <a name="processing_instructions"></a><span class="summary-name">processing_instructions</span> = <code title="True">True</code>
447 <td width="15%" align="right" valign="top" class="summary">
448 <span class="summary-type"> </span>
449 </td><td class="summary">
450 <a name="embedded"></a><span class="summary-name">embedded</span> = <code title="True">True</code>
454 <td width="15%" align="right" valign="top" class="summary">
455 <span class="summary-type"> </span>
456 </td><td class="summary">
457 <a name="frames"></a><span class="summary-name">frames</span> = <code title="True">True</code>
461 <td width="15%" align="right" valign="top" class="summary">
462 <span class="summary-type"> </span>
463 </td><td class="summary">
464 <a name="forms"></a><span class="summary-name">forms</span> = <code title="True">True</code>
468 <td width="15%" align="right" valign="top" class="summary">
469 <span class="summary-type"> </span>
470 </td><td class="summary">
471 <a name="annoying_tags"></a><span class="summary-name">annoying_tags</span> = <code title="True">True</code>
475 <td width="15%" align="right" valign="top" class="summary">
476 <span class="summary-type"> </span>
477 </td><td class="summary">
478 <a name="remove_tags"></a><span class="summary-name">remove_tags</span> = <code title="None">None</code><br />
483 <td width="15%" align="right" valign="top" class="summary">
484 <span class="summary-type"> </span>
485 </td><td class="summary">
486 <a name="allow_tags"></a><span class="summary-name">allow_tags</span> = <code title="None">None</code><br />
491 <td width="15%" align="right" valign="top" class="summary">
492 <span class="summary-type"> </span>
493 </td><td class="summary">
494 <a name="kill_tags"></a><span class="summary-name">kill_tags</span> = <code title="None">None</code><br />
499 <td width="15%" align="right" valign="top" class="summary">
500 <span class="summary-type"> </span>
501 </td><td class="summary">
502 <a name="remove_unknown_tags"></a><span class="summary-name">remove_unknown_tags</span> = <code title="True">True</code>
506 <td width="15%" align="right" valign="top" class="summary">
507 <span class="summary-type"> </span>
508 </td><td class="summary">
509 <a name="safe_attrs_only"></a><span class="summary-name">safe_attrs_only</span> = <code title="True">True</code>
513 <td width="15%" align="right" valign="top" class="summary">
514 <span class="summary-type"> </span>
515 </td><td class="summary">
516 <a name="add_nofollow"></a><span class="summary-name">add_nofollow</span> = <code title="False">False</code>
520 <td width="15%" align="right" valign="top" class="summary">
521 <span class="summary-type"> </span>
522 </td><td class="summary">
523 <a name="host_whitelist"></a><span class="summary-name">host_whitelist</span> = <code title="()"><code class="variable-group">(</code><code class="variable-group">)</code></code>
527 <td width="15%" align="right" valign="top" class="summary">
528 <span class="summary-type"> </span>
529 </td><td class="summary">
530 <a name="whitelist_tags"></a><span class="summary-name">whitelist_tags</span> = <code title="set(['embed', 'iframe'])"><code class="variable-group">set([</code><code class="variable-quote">'</code><code class="variable-string">embed</code><code class="variable-quote">'</code><code class="variable-op">, </code><code class="variable-quote">'</code><code class="variable-string">iframe</code><code class="variable-quote">'</code><code class="variable-group">])</code></code>
534 <td width="15%" align="right" valign="top" class="summary">
535 <span class="summary-type"> </span>
536 </td><td class="summary">
537 <a href="lxml.html.clean.Cleaner-class.html#_tag_link_attrs" class="summary-name" onclick="show_private();">_tag_link_attrs</a> = <code title="{'a': 'href',
538 'applet': ['code', 'object'],
543 'script': 'src'}"><code class="variable-group">{</code><code class="variable-quote">'</code><code class="variable-string">a</code><code class="variable-quote">'</code><code class="variable-op">: </code><code class="variable-quote">'</code><code class="variable-string">href</code><code class="variable-quote">'</code><code class="variable-op">, </code><code class="variable-quote">'</code><code class="variable-string">applet</code><code class="variable-quote">'</code><code class="variable-op">: </code><code class="variable-group">[</code><code class="variable-quote">'</code><code class="variable-string">code</code><code class="variable-quote">'</code><code class="variable-op">, </code><code class="variable-quote">'</code><code class="variable-string">object</code><code class="variable-quote">'</code><code class="variable-group">]</code><code class="variable-op">, </code><code class="variable-ellipsis">...</code></code>
547 <!-- ==================== PROPERTIES ==================== -->
548 <a name="section-Properties"></a>
549 <table class="summary" border="1" cellpadding="3"
550 cellspacing="0" width="100%" bgcolor="white">
551 <tr bgcolor="#70b0f0" class="table-header">
552 <td colspan="2" class="table-header">
553 <table border="0" cellpadding="0" cellspacing="0" width="100%">
555 <td align="left"><span class="table-header">Properties</span></td>
556 <td align="right" valign="top"
557 ><span class="options">[<a href="#section-Properties"
558 class="privatelink" onclick="toggle_private();"
559 >hide private</a>]</span></td>
565 <td colspan="2" class="summary">
566 <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
567 <code>__class__</code>
572 <!-- ==================== METHOD DETAILS ==================== -->
573 <a name="section-MethodDetails"></a>
574 <table class="details" border="1" cellpadding="3"
575 cellspacing="0" width="100%" bgcolor="white">
576 <tr bgcolor="#70b0f0" class="table-header">
577 <td colspan="2" class="table-header">
578 <table border="0" cellpadding="0" cellspacing="0" width="100%">
580 <td align="left"><span class="table-header">Method Details</span></td>
581 <td align="right" valign="top"
582 ><span class="options">[<a href="#section-MethodDetails"
583 class="privatelink" onclick="toggle_private();"
584 >hide private</a>]</span></td>
590 <a name="__init__"></a>
592 <table class="details" border="1" cellpadding="3"
593 cellspacing="0" width="100%" bgcolor="white">
595 <table width="100%" cellpadding="0" cellspacing="0" border="0">
596 <tr valign="top"><td>
597 <h3 class="epydoc"><span class="sig"><span class="sig-name">__init__</span>(<span class="sig-arg">self</span>,
598 <span class="sig-arg">**kw</span>)</span>
599 <br /><em class="fname">(Constructor)</em>
601 </td><td align="right" valign="top"
602 ><span class="codelink"><a href="lxml.html.clean-pysrc.html#Cleaner.__init__">source code</a></span>
606 x.__init__(...) initializes x; see help(type(x)) for signature
610 <dd><em class="note">(inherited documentation)</em></dd>
615 <a name="_has_sneaky_javascript"></a>
616 <div class="private">
617 <table class="details" border="1" cellpadding="3"
618 cellspacing="0" width="100%" bgcolor="white">
620 <table width="100%" cellpadding="0" cellspacing="0" border="0">
621 <tr valign="top"><td>
622 <h3 class="epydoc"><span class="sig"><span class="sig-name">_has_sneaky_javascript</span>(<span class="sig-arg">self</span>,
623 <span class="sig-arg">style</span>)</span>
625 </td><td align="right" valign="top"
626 ><span class="codelink"><a href="lxml.html.clean-pysrc.html#Cleaner._has_sneaky_javascript">source code</a></span>
630 <p>Depending on the browser, stuff like <tt class="rst-rst-docutils literal rst-docutils literal">e x p r e s s i o <span class="pre">n(...)</span></tt>
631 can get interpreted, or <tt class="rst-rst-docutils literal rst-docutils literal">expre/* stuff <span class="pre">*/ssion(...)</span></tt>. This
632 checks for attempt to do stuff like this.</p>
633 <p>Typically the response will be to kill the entire style; if you
634 have just a bit of Javascript in the style another rule will catch
635 that and remove only the Javascript from the style; this catches
636 more sneaky attempts.</p>
642 <!-- ==================== CLASS VARIABLE DETAILS ==================== -->
643 <a name="section-ClassVariableDetails"></a>
644 <table class="details" border="1" cellpadding="3"
645 cellspacing="0" width="100%" bgcolor="white">
646 <tr bgcolor="#70b0f0" class="table-header">
647 <td colspan="2" class="table-header">
648 <table border="0" cellpadding="0" cellspacing="0" width="100%">
650 <td align="left"><span class="table-header">Class Variable Details</span></td>
651 <td align="right" valign="top"
652 ><span class="options">[<a href="#section-ClassVariableDetails"
653 class="privatelink" onclick="toggle_private();"
654 >hide private</a>]</span></td>
660 <a name="_tag_link_attrs"></a>
661 <div class="private">
662 <table class="details" border="1" cellpadding="3"
663 cellspacing="0" width="100%" bgcolor="white">
665 <h3 class="epydoc">_tag_link_attrs</h3>
671 <dd><table><tr><td><pre class="variable">
672 <code class="variable-group">{</code><code class="variable-quote">'</code><code class="variable-string">a</code><code class="variable-quote">'</code><code class="variable-op">: </code><code class="variable-quote">'</code><code class="variable-string">href</code><code class="variable-quote">'</code><code class="variable-op">,</code>
673 <code class="variable-quote">'</code><code class="variable-string">applet</code><code class="variable-quote">'</code><code class="variable-op">: </code><code class="variable-group">[</code><code class="variable-quote">'</code><code class="variable-string">code</code><code class="variable-quote">'</code><code class="variable-op">, </code><code class="variable-quote">'</code><code class="variable-string">object</code><code class="variable-quote">'</code><code class="variable-group">]</code><code class="variable-op">,</code>
674 <code class="variable-quote">'</code><code class="variable-string">embed</code><code class="variable-quote">'</code><code class="variable-op">: </code><code class="variable-quote">'</code><code class="variable-string">src</code><code class="variable-quote">'</code><code class="variable-op">,</code>
675 <code class="variable-quote">'</code><code class="variable-string">iframe</code><code class="variable-quote">'</code><code class="variable-op">: </code><code class="variable-quote">'</code><code class="variable-string">src</code><code class="variable-quote">'</code><code class="variable-op">,</code>
676 <code class="variable-quote">'</code><code class="variable-string">layer</code><code class="variable-quote">'</code><code class="variable-op">: </code><code class="variable-quote">'</code><code class="variable-string">src</code><code class="variable-quote">'</code><code class="variable-op">,</code>
677 <code class="variable-quote">'</code><code class="variable-string">link</code><code class="variable-quote">'</code><code class="variable-op">: </code><code class="variable-quote">'</code><code class="variable-string">href</code><code class="variable-quote">'</code><code class="variable-op">,</code>
678 <code class="variable-quote">'</code><code class="variable-string">script</code><code class="variable-quote">'</code><code class="variable-op">: </code><code class="variable-quote">'</code><code class="variable-string">src</code><code class="variable-quote">'</code><code class="variable-group">}</code>
679 </pre></td></tr></table>
685 <!-- ==================== NAVIGATION BAR ==================== -->
686 <table class="navbar" border="0" width="100%" cellpadding="0"
687 bgcolor="#a0c0ff" cellspacing="0">
690 <th> <a
691 href="lxml-module.html">Home</a> </th>
694 <th> <a
695 href="module-tree.html">Trees</a> </th>
698 <th> <a
699 href="identifier-index.html">Indices</a> </th>
702 <th> <a
703 href="help.html">Help</a> </th>
705 <!-- Project homepage -->
706 <th class="navbar" align="right" width="100%">
707 <table border="0" cellpadding="0" cellspacing="0">
708 <tr><th class="navbar" align="center"
709 ><a class="navbar" target="_top" href="/">lxml API</a></th>
713 <table border="0" cellpadding="0" cellspacing="0" width="100%%">
715 <td align="left" class="footer">
716 Generated by Epydoc 3.0.1 on Tue Jul 31 10:14:19 2012
718 <td align="right" class="footer">
719 <a target="mainFrame" href="http://epydoc.sourceforge.net"
720 >http://epydoc.sourceforge.net</a>
725 <script type="text/javascript">
727 // Private objects are initially displayed (because if
728 // javascript is turned off then we want them to be
729 // visible); but by default, we want to hide them. So hide
730 // them unless we have a cookie that says to show them.