[gxml] Work around on Bug #768913. DOM4 API incompatibility



commit 67a9f186918e6d279ed54992021586669c1c7faf
Author: Daniel Espinosa <esodan gmail com>
Date:   Mon Jul 18 00:59:49 2016 -0500

    Work around on Bug #768913. DOM4 API incompatibility
    
    Due to bug #768913, GXml.DomHTMLCollection.get() has been renamed to
    .get_element(), is not in line with DOM4 specificacion and due
    to problems to change Gee API for List interface.

 gxml/DomCollections.vala     |    2 +-
 gxml/DomElement.vala         |    7 ++++++-
 gxml/Element.vala            |    7 ++++++-
 gxml/GXmlDomCollections.vala |    4 ++++
 gxml/GXmlListChildren.vala   |    2 +-
 5 files changed, 18 insertions(+), 4 deletions(-)
---
diff --git a/gxml/DomCollections.vala b/gxml/DomCollections.vala
index 1626a40..c0cce20 100644
--- a/gxml/DomCollections.vala
+++ b/gxml/DomCollections.vala
@@ -51,7 +51,7 @@ public interface GXml.DomNodeList : GLib.Object, Gee.BidirList<GXml.DomNode>  {
 }
 
 public interface GXml.DomHTMLCollection : GLib.Object, Gee.BidirList<GXml.DomElement> {
-  public abstract new GXml.DomElement get (int index);
+  public abstract new GXml.DomElement get_element (int index); // FIXME: See bug #768913
   public virtual new GXml.DomElement[] to_array () {
     return (GXml.DomElement[]) ((Gee.Collection<GXml.Element>) this).to_array ();
   }
diff --git a/gxml/DomElement.vala b/gxml/DomElement.vala
index d146ddc..e232f2d 100644
--- a/gxml/DomElement.vala
+++ b/gxml/DomElement.vala
@@ -52,4 +52,9 @@ public interface GXml.DomElement : GLib.Object,
   public abstract DomHTMLCollection get_elements_by_class_name (string class_names);
 }
 
-public class GXml.DomElementList : Gee.ArrayList<DomElement>, GXml.DomHTMLCollection {}
+public class GXml.DomElementList : Gee.ArrayList<DomElement>, GXml.DomHTMLCollection {
+  // DomHTMLCollection
+  public new GXml.DomElement get_element (int index) {
+    return (GXml.DomElement) this.get (index);
+  }
+}
diff --git a/gxml/Element.vala b/gxml/Element.vala
index ca94ad1..97a2e97 100644
--- a/gxml/Element.vala
+++ b/gxml/Element.vala
@@ -80,4 +80,9 @@ public interface GXml.Element : Object, GXml.Node
  * Convenient class for a list of {@link GXml.Element} objects based on
  * {@link Gee.ListArray}, with good support for bindings.
  */
-public class GXml.ElementList : ArrayList<Element>, GXml.DomHTMLCollection {}
+public class GXml.ElementList : ArrayList<Element>, GXml.DomHTMLCollection {
+  // DomHTMLCollection
+  public new GXml.DomElement get_element (int index) {
+    return (GXml.DomElement) this.get (index);
+  }
+}
diff --git a/gxml/GXmlDomCollections.vala b/gxml/GXmlDomCollections.vala
index 7145955..1435f4c 100644
--- a/gxml/GXmlDomCollections.vala
+++ b/gxml/GXmlDomCollections.vala
@@ -127,4 +127,8 @@ public class GXml.GDomHTMLCollection : Gee.ArrayList<GXml.DomElement>,
     }
     return null;
   }
+  // DomHTMLCollection
+  public new GXml.DomElement get_element (int index) {
+    return (GXml.DomElement) this.get (index);
+  }
 }
diff --git a/gxml/GXmlListChildren.vala b/gxml/GXmlListChildren.vala
index 59d3a0d..9c3edd7 100644
--- a/gxml/GXmlListChildren.vala
+++ b/gxml/GXmlListChildren.vala
@@ -254,7 +254,7 @@ public class GXml.GListChildren : AbstractBidirList<GXml.Node>,
   public DomNode? item (ulong index) { return (DomNode) @get ((int) index); }
   public ulong length { get { return (ulong) size; } }
   // DomHTMLCollection
-  public new GXml.DomElement GXml.DomHTMLCollection.get (int index) {
+  public new GXml.DomElement get_element (int index) {
     return (GXml.DomElement) this.get (index);
   }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]