From 7.x.x to 8.x.x
Within 7.x.x
From 6.x to 7.0
Overview
The 8.0.0 version of JxBrowser not only adds better support for Kotlin and Compose, but also introduces a few breaking API changes. This guide shows how to change your application code written with JxBrowser 7 to work with version 8.
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:
Java
Kotlin
String value = element.attributeValue("src");
val value = element.attributeValue("src")
In JxBrowser 8:
Java
Kotlin
var value = element.attributes().get("src");
val value = element.attributes["src"]
Write the attribute value
In JxBrowser 7:
Java
Kotlin
element.putAttribute("src", "https://example.com/image.png");
element.putAttribute("src", "https://example.com/image.png")
In JxBrowser 8:
Java
Kotlin
element.attributes().put("src", "https://example.com/image.png");
element.attributes["src"] = "https://example.com/image.png"
Remove the attribute
In JxBrowser 7:
Java
Kotlin
element.removeAttribute("src");
element.removeAttribute("src")
In JxBrowser 8:
Java
Kotlin
element.attributes().remove("src");
element.attributes.remove("src")
Remove if the attribute specified
In JxBrowser 7:
Java
Kotlin
boolean exists = element.hasAttribute("src");
val exists = element.hasAttribute("src")
In JxBrowser 8:
Java
Kotlin
var exists = element.attributes().contains("src");
val exists = element.attributes.contains("src")
Get the map of attributes
In JxBrowser 7:
Java
Kotlin
Map<String, String> attributes = element.attributes();
val attributes = element.attributes()
In JxBrowser 8:
Java
Kotlin
var attributes = element.attributes().asMap();
val attributes = element.attributes.asMap()
Get the map of attribute nodes
In JxBrowser 7:
Java
Kotlin
List<Attribute> attributes = element.attributeNodes();
val attributes = element.attributeNodes()
In JxBrowser 8:
Java
Kotlin
var attributes = element.attributes().asNodes();
val attributes = 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.