Change Node to make firstChild, lastChild, previousSibling and nextSibling be calculated properties

The current implementation of Node never sets the firstChild, lastChild, previousSibling and nextSibling properties, meaning that they don't work. The DOM spec says that these properties are readonly. This makes them good candidates for calculated properties, based on the childNodes list. SVGKit already has a class, SVGElementInstance, that implements these as calculated properties. This pull request copies the code for these properties from SVGElementInstance.m into Node.m, and changes Node+Mutable.h to not make them readwrite.

The motivation for this change is the scenario where the SVG DOM is queried and modified, for example for apps that support minor edits of the SVG.

The other option for changing firstChild, lastChild, previousSibling and nextSibling would be to keep them as real properties and to make methods like insertBefore, replaceChild, removeChild and appendChild update them as appropriate. However I believe that this approach would be harder to maintain, and easier for them to get into an inconsistent state.
Why? They’re already defined as readonly in Node.h; there’s no need to duplicate that definition in Node+Mutable.h.

> On Oct 28, 2014, at 12:00 PM, MaddTheSane <notifications@github.com> wrote:
> 
> In Source/DOM classes/Core DOM/Node+Mutable.h:
> 
> > @@ -10,10 +10,6 @@
> >  @property(nonatomic,readwrite) DOMNodeType nodeType;
> >  @property(nonatomic,assign,readwrite) Node* parentNode;
> >  @property(nonatomic,retain,readwrite) NodeList* childNodes;
> > -@property(nonatomic,assign,readwrite) Node* firstChild;
> > -@property(nonatomic,assign,readwrite) Node* lastChild;
> > -@property(nonatomic,assign,readwrite) Node* previousSibling;
> > -@property(nonatomic,assign,readwrite) Node* nextSibling;
> I'd suggest putting these back as readonly properties, like so:
> 
> @property(nonatomic,assign,readonly) Node* firstChild;
> @property(nonatomic,assign,readonly) Node* lastChild;
> @property(nonatomic,assign,readonly) Node* previousSibling;
> @property(nonatomic,assign,readonly) Node* nextSibling;
> —
> Reply to this email directly or view it on GitHub <https://github.com/SVGKit/SVGKit/pull/231/files#r19495150>.
>