www.orico.co.jp - layout is messed up
URL: http://www.orico.co.jp/ Browser / Version: Firefox 37.0.2 Operating System: Android Problem type: Layout is messed up
Steps to Reproduce
- Navigate to: http://www.orico.co.jp/ https://order.orico.co.jp which is online order for credit card has layout problem. To get there, go to "http://www.orico.co.jp/creditcard" then click any credit card. press ”オンライン申込” in credit card description page.
Expected Behavior: Should be displaying smartphone optimized page.
Actual Behavior: Layout is broken. Buttons located very bottom of the page is broken.
Country: jp
Following the instruction above, I went to http://www.orico.co.jp/creditcard/thepoint Then click on the orange button. We access a page which seems to be made for desktop and displays correctly, but then suddenly the page is being redrawn and the layout is messed up. Specifically the button at the bottom.
<div class="button_area">
<input class="BtnStyle1"
style="width: 200px; background-image: url("common/image/standard/button/notagree.png"); height: 55px; background-position: -205px 0px;"
value="" name="notAgree" type="submit">
<input class="BtnStyle1"
style="width: 200px; background-image: url("common/image/standard/button/agree.png"); height: 55px; display: none;"
value="" name="agree" type="submit">
<input style="width: 200px; background-image: url("common/image/standard/button/agree_disable.png"); height: 55px;"
value="" name="noTouch" type="button">
</div>
The style of the button is done through JS
$(".BtnStyle1").each(function() {
$(this).hover(
function() {
$(this).css("background-position", "-205px 0px");
},
function() {
$(this).css("background-position", "0px 0px");
}
);
});
We need to dig a bit more for identifying clearly the issue.
Hmm yes. It seems like there's a kind of script to "smartphone-ify" the desktop site. I suspect it's this FormAssist stuff:
https://formassist.jp/api/javascript/lib/library.js?tmp=1431460734364 https://formassist.jp/api/spc/lib/2.002.js?tmp=1431460734364
The 2.002.js creates a dyanamic stylesheet which injects the following:
<link id="NC_spc_stylesheet_0" rel="stylesheet" type="text/css" charset="UTF-8" href="https://formassist.jp/api/spc/lib/2.002.css?tmp=1431460812686">
In the formassist.jp assets, I see some some -webkit- prefixed gradients, box-sizing, box-shadow, transforms, border radius.
Also some -webkit- prefixed transforms and transitions on order.orico.jp inline.
But this is complex stuff. I need to come back to it without a headache.
So this is interesting. There's an additional Custom style element that Chrome gets (filled with HTML <br> :open_mouth: ), and it's empty for us. Unsure if it's empty because we refuse to parse that, or something else.

In 2.002.js
css : function() {
var txt = "";
if (typeof ($NC_TPL) != 'undefined'
&& typeof ($NC_TPL.spc) != 'undefined'
&& typeof ($NC_TPL.spc.custom) != 'undefined'
&& $NC_TPL.spc.custom.css) {
txt += $NC.spc.custom_value.decode($NC_TPL.spc.custom.css);
}
if (typeof ($NC_DATA) != 'undefined'
&& typeof ($NC_DATA.spc) != 'undefined'
&& typeof ($NC_DATA.spc.custom) != 'undefined'
&& $NC_DATA.spc.custom.css) {
txt += $NC.spc.custom_value.decode($NC_DATA.spc.custom.css);
}
if (txt) {
var s = document.createElement("style");
s.id = 'NC_spc_stylesheet_custom';
s.type = 'text/css';
s.innerText = txt;
document.getElementsByTagName("head")[0].appendChild(s);
}
}
If I paste the CSS into the empty style element (without the <br>s), the page is fixed.
/* 共通 */
a.NC_spc_link:not(.NC_spc_noconv) {
background: none;
border-bottom: none;
margin: 0 !important;
padding-right: 0 !important;
width: auto !important;
}
td.required,
.NC_spc_cpanel,
div[style="width: 100%; height: 28px;"],
td[width="2%"],
td.required,
body > script + div:not(.NC_spc_noconv) {
display: none !important;
}
.NC_spc_hidden {
display: block !important;
}
* {
-webkit-box-sizing: border-box !important;
}
/* 電話番号リンク化対策 */
a[href^="tel:"] {
text-decoration: none;
color: black;
}
/* ヘッダー */
div.panel div.classification {
background: url(/weborder/common/image/standard/classification_bg.png) no-repeat;
height: 66px;
line-height: 66px !important;
margin: 2px !important;
text-align: left;
font-size: 130% !important;
font-weight: bold;
text-indent: 1.5em;
overflow: hidden;
border-right: 1px solid #CCC;
border-radius: 4px 4px;
}
div.step {
margin: 10px 0 !important;
}
div.step img {
max-width: 304px !important;
}
div.classification label {
font-size: 16px !important;
line-height: 63px;
}
.screen_name .name {
font-size: 130%;
line-height: 35px;
text-indent: 20px;
background: url(/weborder/common/image/standard/h3_bg.gif) no-repeat;
font-weight: bold;
}
/* 見出し */
div.card_title {
font-size: 130%;
text-indent: 2em;
background: url(/weborder/common/image/standard/h2_bg.gif) no-repeat;
line-height: 40px;
margin-left: 2em;
font-weight: bold;
}
div.category div.title {
font-size: 130%;
text-indent: 2em;
background: url(/weborder/common/image/standard/h2_bg.gif) no-repeat;
line-height: 40px;
font-weight: bold;
margin-top: 10px !important;
}
table.card {
margin: 10px 0 !important;
}
table.card td.cardname_bg_top {
background: #f4ecdf;
border-top: 1px solid #ccc;
border-right: 1px solid #ccc;
border-left: 1px solid #ccc;
border-radius: 5px 5px 0 0 !important;
height: 10px !important;
}
table.card td.cardname_bg {
background: #f4ecdf;
padding: 0 7px 0 20px !important;
border-right: 1px solid #ccc;
border-left: 1px solid #ccc;
font-weight: bold;
font-size: 16px !important;
}
table.card td.cardname_bg_bottom {
background: #f4ecdf;
border-bottom: 1px solid #ccc;
border-right: 1px solid #ccc;
border-left: 1px solid #ccc;
border-radius: 0 0 5px 5px !important;
height: 10px !important;
}
table.card td.cardname_bg table {
width: 250px !important;
}
div.panel > div:nth-of-type(8) div.items.em div.item > div:nth-of-type(2),
div.panel > div:nth-of-type(7) div.items.em div.item div:nth-of-type(2),
div.panel > div:nth-of-type(6) div.items.em div.item div:nth-of-type(2) {
font-weight: bold;
width: 135px !important;
float: left !important;
margin-left: 125px !important;
}
div.panel > div:nth-of-type(8) div.items.em div.item div:nth-of-type(3),
div.panel > div:nth-of-type(7) div.items.em div.item div:nth-of-type(3),
div.panel > div:nth-of-type(6) div.items.em div.item div:nth-of-type(3) {
float: left !important;
margin-bottom: 10px !important;
}
div.panel > div:nth-of-type(7) {
margin-bottom: 10px !important;
}
/* iframe text-area */
div#ifr_div,
div#txtr_div0,
div#txtr_div1,
div#txtr_div2 {
padding: 0 7px !important;
margin: 10px 0 !important;
}
div#ifr_div table:not(.NC_spc_noconv) {
width: 280px !important;
}
div.check {
padding: 5px !important;
width: 105px;
margin: 10px 0 !important;
}
div.check div.range {
display: inline;
}
div.detail_item.opt > div:nth-of-type(1) {
padding: 5px !important;
}
div.detail_item.opt span[style="font-size:110%;color:red;"] {
white-space: normal !important;
display: block;
margin: 7px !important;
}
div.detail_item.opt p {
margin: 7px !important;
}
div.detail_item.opt span {
white-space: normal !important;
display: block;
margin: 7px 0 !important;
}
/* フォーム */
input[type="checkbox"].NC_spc_noconv {
-webkit-transform: scale(1.5, 1.5);
-webkit-transform-origin: 50% 50%;
vertical-align: middle;
}
/* フッター */
div.button_area {
text-align: center;
margin-top: 20px !important;
}
div.button_area input {
background-repeat: no-repeat;
border: 0;
margin-bottom: 10px !important;
}
/* 20130730 改修 */
div.items.em textarea {
width: 300px !important;
height: 200px;
padding: 0 5px !important;
}
div.detail_item.opt > div[style="font-size:100%;text-align:left;border: 1px solid #FF0000;color:red;margin:2px;padding:5px;"] {
margin-top: 10px !important;
padding-left: 7px !Important;
Alright, here's the bug. Minimal test case here: https://miketaylr.com/bzla/br-css.html (view source).
The custom CSS code (which is really a string in an object called $NC_DATA) from formassist.jp has %n% to delimit line breaks. It's run through a decode function which replaces those with \n. Then it's put inside a <style> element and injected into the DOM.
Chrome seems to be happy with this, though the \n ends up as <br>. Gecko it seems just throws everything away, as the style element is empty.
The original encoding of this document is Shift JIS, but changing that to different things doesn't seem to have an effect. @dholbert, any insight into this?
Your minimal testcase sets the <style> contents via .innerText, which it looks like we don't support. If you use .textContent instead, it works. (WHAT IN THE WORLD ends up red).
See also http://stackoverflow.com/questions/1359469/innertext-works-in-ie-but-not-in-firefox
(IIUC that's all this is; nothing magic about the %n% or anything like that)
@dholbert, d'oh! That should have been more obvious.
To fix this, we'll need the people at FormAssist to do the following:
In 2.002.js, they need to change s.innerText = txt; to s.textContent = txt;. This will work in all modern mobile browsers (since they only serve this to mobile, no need to worry about old IE compat):
if (txt) {
var s = document.createElement("style");
s.id = 'NC_spc_stylesheet_custom';
s.type = 'text/css';
s.textContent = txt;
document.getElementsByTagName("head")[0].appendChild(s);
}
@karlcow, should we close this bug and re-open one for formassist.jp?
Referencing the innerText issue at Mozilla Bugzilla.
@karlcow, should we close this bug and re-open one for formassist.jp?
@miketaylr given that the fix is out of the hand of oricon.co.jp domain. That seems to be the good way to proceed.
Let's open a new bug.
ok done with bug #1127