We probably could... not sure if that would be clearer or better.


On 2013-09-13 17:17, Bart van den Eijnden wrote:
>
> In lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js:
>
> > @@ -139,11 +146,25 @@ OpenLayers.Format.WCSCapabilities.v1_0_0 = OpenLayers.Class(
> >                  this.readChildNodes(node, coverageOfferingBrief);
> >                  contentMetadata.push(coverageOfferingBrief);
> >              },
> > -            "name": function(node, coverageOfferingBrief) {
> > -                coverageOfferingBrief.name = this.getChildValue(node);
> > +            "name": function(node, serviceOrCoverageOfferingBrief) {
> > +                if(node.parentNode.nodeName === "Service") {
> > +                    // We're parsing a service description
> > +                    serviceOrCoverageOfferingBrief.title = this.getChildValue(node);
>
> just thinking out loud here, but instead of checking the parent node, 
> can we pass in a property in the parent node's reader instead?
> So e.g.:
>
> |"Service": function(node, obj) {
>      obj.service = {nameProperty: 'title'};
>      this.readChildNodes(node, obj.service);
> },
> "name": function(node, obj) {
>      obj[obj.nameProperty] = this.getChildValue(node);
>      delete obj.nameProperty;
> }
> |
>
> —
> Reply to this email directly or view it on GitHub 
> <https://github.com/openlayers/openlayers/pull/846/files#r6328571>.
>