Skip to content

Commit 8b7de76

Browse files
committed
Fix mistake in XML component system
Use argument value instead of argument type, previously the component system would instantiate <component name="Foo" args="blah: String"> <p>{blah}</p> </component> <Foo blah="Test"/> with "<p>String</p>" instead of: "<p>Test</p>".
1 parent ff06433 commit 8b7de76

File tree

4 files changed

+16
-53
lines changed

4 files changed

+16
-53
lines changed

Cargo.lock

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

azul/xml.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ fn validate_and_filter_component_args(xml_attributes: &XmlAttributeMap, valid_ar
577577
for (xml_attribute_name, xml_attribute_value) in xml_attributes.iter() {
578578

579579
let arg_value = match valid_args.get(xml_attribute_name) {
580-
Some(s) => Some(s),
580+
Some(valid_arg_type) => Some(xml_attribute_value),
581581
None => {
582582
if DEFAULT_ARGS.contains(&xml_attribute_name.as_str()) {
583583
None // no error, but don't insert the attribute name

examples/xml/ui.xml

+13-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1-
<app>
2-
<div id="wrapper">
3-
<div id="overflowing_1"></div>
4-
<div id="overflowing_2">
5-
<div id="overflowing_3"></div>
1+
<component name="MenuBarLabel" args="menu_name: String">
2+
<div class="menubar_label_container">
3+
<p class="menubar_label">{menu_name}</p>
4+
</div>
5+
</component>
6+
7+
<component name="MenuBar">
8+
<div class="menubar_container">
9+
<MenuBarLabel menu_name="Test"/>
610
</div>
7-
</div>
11+
</component>
12+
13+
<app>
14+
<MenuBar />
815
</app>

examples/xml/xml.css

-46
Original file line numberDiff line numberDiff line change
@@ -1,46 +0,0 @@
1-
* {
2-
border: 1px solid black;
3-
box-sizing: border-box;
4-
border-radius: 10px;
5-
}
6-
7-
#wrapper {
8-
top: 50px;
9-
left: 50px;
10-
width: 400px;
11-
height: 400px;
12-
background: green;
13-
overflow: scroll;
14-
}
15-
16-
#overflowing_1 {
17-
position: absolute;
18-
top: 200px;
19-
left: 40px;
20-
width: 40px;
21-
height: 40px;
22-
background: red;
23-
}
24-
25-
#overflowing_2 {
26-
position: absolute;
27-
top: 290px;
28-
left: 40px;
29-
width: 40px;
30-
height: 40px;
31-
background: blue;
32-
overflow: visible;
33-
}
34-
35-
#overflowing_3 {
36-
position: absolute;
37-
width: 40px;
38-
height: 40px;
39-
top: 100px;
40-
left: 100px;
41-
background: yellow;
42-
}
43-
44-
#overflowing_3:hover {
45-
background-color: red;
46-
}

0 commit comments

Comments
 (0)