DOMHelperUtilities.h 1.4 KB

1234567891011121314151617181920212223242526272829
  1. /**
  2. There are some shared methods in DOM specification, where two classes have the same method, but
  3. are NOT subclass/superclass of each other. This is very bad from OOP design POV, because it means
  4. we end up with copy/paste duplicated code, very VERY likely to gain long term bugs.
  5. Also, those methods REQUIRE a second, recursive, method or else you can't implement them easily.
  6. So, we move their implementations into this helper class, so they can share implementation.
  7. (c.f. Element vs Document - identical methods for getElementsByName)
  8. */
  9. #import <Foundation/Foundation.h>
  10. @class Node, NodeList, Element; // avoiding #import here, to avoid C header loop problems.
  11. #define DEBUG_DOM_MATCH_ELEMENTS_IDS_AND_NAMES 0 // For debugging SVGKit: causes debug output on getElementById etc
  12. @interface DOMHelperUtilities : NSObject
  13. /*! This useful method provides both the DOM level 1 and the DOM level 2 implementations of searching the tree for a node - because THEY ARE DIFFERENT
  14. yet very similar
  15. */
  16. +(void) privateGetElementsByName:(NSString*) name inNamespace:(NSString*) namespaceURI childrenOfElement:(Node*) parent addToList:(NodeList*) accumulator;
  17. /*! This is used in multiple base classes in DOM 1 and DOM 2 where they do NOT have shared superclasses, so we have to implement it here in a separate
  18. clas as a standalone method */
  19. +(Element*) privateGetElementById:(NSString*) idValue childrenOfElement:(Node*) parent;
  20. @end