List icon Contents

Overview

The 8.0.0 version of JxBrowser not only adds better support for Kotlin and Compose, but also introduces a few breaking changes. This guide shows how to change your application code written with JxBrowser version 7.x.x to work with version 8.x.x.

JxBrowser 8 is current in preview stage. See the roadmap for details.

Element attributes

We extracted operations with attributes from Element to a map-like ElementAttributes. Here’s how to change the code that worked with attributes.

Get the attribute value

In JxBrowser 7:

String value = element.attributeValue("src");
val value : String = element.attributeValue("src")

In JxBrowser 8:

String value = element.attributes.get("src");
val value : String = element.attributes["src"]

Write the attribute value

In JxBrowser 7:

element.putAttribute("src", "https://example.com/image.png");
element.putAttribute("src", "https://example.com/image.png")

In JxBrowser 8:

element.attributes.put("src", "https://example.com/image.png");
element.attributes["src"] = "https://example.com/image.png"

Remove the attribute

In JxBrowser 7:

element.removeAttribute("src");
element.removeAttribute("src")

In JxBrowser 8:

element.attributes.remove("src");
element.attributes.remove("src")

Remove if the attribute specified

In JxBrowser 7:

boolean exists = element.hasAttribute("src");
val exists : Boolean = element.hasAttribute("src")

In JxBrowser 8:

boolean exists = element.attributes.contains("src");
val exists : Boolean = element.attributes.contains("src")

Get the map of attributes

In JxBrowser 7:

Map<String, String> attributes = element.attributes();
val attributes : Map<String, String> = element.attributes()

In JxBrowser 8:

Map<String, String> attributes = element.attributes.asMap();
val attributes : Map<String, String> = element.attributes.asMap()

Get the map of attribute nodes

In JxBrowser 7:

List<Attribute> attributes = element.attributeNodes();
val attributes : List<Attribute> = element.attributeNodes()

In JxBrowser 8:

List<Attribute> attributes = element.attributes.asNodes();
val attributes : List<Attribute> = element.attributes.asNodes()

Getting help

In case you did not find the answer in this guide, and you need assistance with migration, please contact us. We will be happy to help.

Go top