You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 satır
2.3KB

  1. Handling Content Model Changes
  2. 1. Context
  3. The distinction between Transitional and Strict document types is somewhat
  4. of an anomaly in the lineage of XHTML document types (following 1.0, no
  5. doctypes do not have flavors: instead, modularization is used to let
  6. document authors vary their elements). This transition is usually quite
  7. straight-forward, as W3C usually deprecates attributes or elements, which
  8. are quite easily handled using tag and attribute transforms.
  9. However, for two elements, <blockquote>, <body> and <address>, W3C elected
  10. to also change the content model. <blockquote> and <body> originally
  11. accepted both inline and block elements, but in the strict doctype they
  12. only allow block elements. With <address>, the situation is inverted:
  13. <p> tags were now forbidden from appearing within this tag.
  14. 2. Current situation
  15. Currently, HTML Purifier treats <blockquote> specially during Tidy mode
  16. using a custom ChildDef class StrictBlockquote. StrictBlockquote
  17. operates similarly to Required, except that when it encounters an inline
  18. element, it will wrap it in a block tag (as specified by
  19. %HTML.BlockWrapper, the default is <p>). The naming suggests it can
  20. only be used for <blockquote>s, although it may be possible to
  21. genericize it to work on other cases of this nature (this would be of
  22. little practical application, as no other element in XHTML 1.1 or earlier
  23. has a block-only content model).
  24. Tidy currently contains no custom, lenient implementation for <address>.
  25. If one were to be written, it would likely operate on the principle that,
  26. when a <p> tag were to be encountered, it would be replaced with a
  27. leading and trailing <br /> tag (the contents of <p>, being inline, are
  28. not an issue). There is no prior work with this sort of operation.
  29. 3. Outside applicability
  30. There are a number of other elements that contain restrictive content
  31. models, such as <ul> or <span> (the latter is restrictive in that it
  32. does not allow block elements). In the former case, an errant node
  33. is eliminated completely, in the latter case, the text of the node
  34. would is preserved (as the parent node does allow PCDATA). Custom
  35. content model implementations probably are not the best way of handling
  36. these cases, instead, node bubbling should be implemented instead.
  37. vim: et sw=4 sts=4